<colgroup>, <tfoot> to library Table.php ? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: <colgroup>, <tfoot> to library Table.php ? (/showthread.php?tid=38469) |
<colgroup>, <tfoot> to library Table.php ? - El Forum - 02-08-2011 [eluser]Jaketoolson[/eluser] For css styling purposes, I rely on <colgroup> in my tables to zebra stripe my table columns. Your Table.php library lacks code inserting <colgroup /> into the table structure. While I'm on the subject, it has <thead> code but is also lacking <tfoot>. I just thought it would be nice if you consider including them in the library function to be me complete and thorough. I added the following code to the table library right after the table headings are generated: Code: for($i=0;$i<=$total_rows;$i++) And then of course to the _default_template function, I added the following code to the array: Code: 'colgroup' => '<colgroup></colgroup>', One thing I'm excited about is the ability to apply a function to the cell data! This is EXACTLY what I needed and it didn't exist in the previous version of CI and I therefore was filtering the data before the table was generated. Now I can just run the callback function at the cell level. Thanks! <colgroup>, <tfoot> to library Table.php ? - El Forum - 02-23-2011 [eluser]dansmith65[/eluser] I was also surprised to not see an option for adding a <colgroup>. I used this method to 'trick' CI into adding a <colgroup>... Code: $tmpl = array( Also, I can't seem to find a way to make the text in a column bold. <colgroup> does not support the font-weight style, and I don't see any way in the table class to target the <td> of a particular column. The only way I can think is to add a <span> to the data in a column, before adding it to the table. Is there a better way? If not, I'd love to see that option in a future release of CI. <colgroup>, <tfoot> to library Table.php ? - El Forum - 02-24-2011 [eluser]Jaketoolson[/eluser] Interesting, I did not realize <colgroup> didn't support the font-weight style. Couldn't you achieve the same thing using jQuery? Code: $('table td:odd').addClass('bold'); <colgroup>, <tfoot> to library Table.php ? - El Forum - 02-24-2011 [eluser]dansmith65[/eluser] Thanks for that. I hadn't thought about using javascript to add a class. I'd prefer to not have to, but that does seem like the easiest method. <colgroup>, <tfoot> to library Table.php ? - El Forum - 02-24-2011 [eluser]Jaketoolson[/eluser] I use colgroups to style my column background colors, but never thought about using font style's and never came across this ! But the jQuery method is the only thing that came to mind. |