• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
<colgroup>, <tfoot> to library Table.php ?

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:
   $out .= $this->template['colgroup'];
   $out .= $this->newline;    

And then of course to the _default_template function, I added the following code to the array:
'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!

I was also surprised to not see an option for adding a <colgroup>. I used this method to 'trick' CI into adding a <colgroup>...
$tmpl = array(
    'table_open' => '<table><colgroup><col class="col1"/><col class="col2"/></colgroup>',

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.

Interesting, I did not realize <colgroup> didn't support the font-weight style. Couldn't you achieve the same thing using jQuery?

$('table td:odd').addClass('bold');

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.

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.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.