Dynamic Colspan - Php - Stack Overflow
Có thể bạn quan tâm
Here's something to get your started. It is probably not the most elegant, but it will do.
<tr> <? $counter = 0; $lastrow = floor($count($data)/4)*4; $numinlastrow = $count($data)%4; foreach($data as $d) { if($counter % 4 == 0) { echo '</tr><tr>'; } $colspan = 1; if ($counter >= $lastrow) { if ($numinlastrow == 1) $colspan = 4; if ($numinlastrow == 2) $colspan = 2; if ($numinlastrow == 3) ; // ?? } echo "<td colspan='".$colspan."'>"; //... contents of table cell here echo "</td>"; $counter++ } ?> </tr>If there are 3 table cells, it isn't really possible with the method above, because colspan can only span whole table columns (no fractions).
So, instead, put a table inside a table cell spanning the whole row...
<tr> <? $counter = 0; $lastrow = floor($count($data)/4)*4; $numinlastrow = $count($data)%4; foreach($data as $d) { if($counter % 4 == 0) { if ($counter >= $lastrow) { echo '</tr><tr><td colspan="4"><table><tr>'; } else echo '</tr><tr>'; } echo "<td>"; //... contents of table cell here echo "</td>"; $counter++ } if ($numinlastrow != 0) echo '</tr></table></td>' ?> </tr>Từ khóa » Html Colspan Dynamic
-
ColSpan - Dynamic HTML: The Definitive Reference [Book] - O'Reilly
-
How To Deal With Table Colspans That May Change At Runtime - SitePoint
-
Dynamic Colspan / Colspan All Columns On Bootstrap Sample
-
How Can I Create Col Span Or Row Span On Dynamic Table.
-
Colspan On Dynamically Loaded Content — DataTables Forums
-
SO Qn: Create A Table With Colspan And An Dynamic ... - JSFiddle
-
Dynamic Colspan In Angular Code Example
-
Dynamic Colspans With Angular - CodePen
-
How To Set Colspan Value Dynamically In QWeb? - Odoo
-
How To Dynamically Add Colspan To Different
In Table (Angular 4) How To Dynamically Add Colspan To Different Th In Table Angular 4
Js Method For Dynamically Modifying The Column Span Of Colspan ...
Building Dynamic Tables Cells And Specifying Colspan - Javascript
HTML DOM TableData ColSpan Property - W3Schools
Copyright © 2022 | Thiết Kế Truyền Hình Cáp Sông Thu