CodeIgniter Forums
Table Class is missing <thead> and <tbody> options - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Table Class is missing <thead> and <tbody> options (/thread-9336.html)



Table Class is missing <thead> and <tbody> options - El Forum - 06-22-2008

[eluser]Dave Stewart[/eluser]
Hi All,

The table class is not quite fulfilling my expectations, as it's missing <thead> and <tbody> tags. This means I can't do cool stuff like sortable tables with jQuery, like this:

http://tablesorter.com/docs/#Demo

What would be the best way for me to fix this?

- Extend the table class?
- Copy the class, re-write it and place in the application/library folder?
- Something else?

I'm new to CI, so your help with best-practices is appreciated.
Thanks,
Dave


Table Class is missing <thead> and <tbody> options - El Forum - 06-22-2008

[eluser]Dave Stewart[/eluser]
OK, I've copied the class and made the edits successfully, and it works just fine as a replacement class, and also as an extended MY_Table class.

If anyone wants the class, I'll upload it to my server.

Cheers,
Dave


Table Class is missing <thead> and <tbody> options - El Forum - 06-22-2008

[eluser]Référencement Google[/eluser]
You can put it on the [url="http://codeigniter.com/wiki]Wiki[/url], or post it here on the forums if it's not too long, it will sure be useful for some people.


Table Class is missing <thead> and <tbody> options - El Forum - 10-13-2008

[eluser]blasto333[/eluser]
There is no need to do this, simply modify the table template.
Code:
$tmpl = array (
    'table_open'          => '<table class="tablesorter">',
    'heading_row_start'   => '<thead><tr>',
    'heading_row_end'     => '</tr></thead><tbody>',
    'table_close'         => '&lt;/body&gt;&lt;/table>'
    );

$this->table->set_template($tmpl);



Table Class is missing <thead> and <tbody> options - El Forum - 10-13-2008

[eluser]Colin Williams[/eluser]
Good call, blasto333. I didn't remember having a problem with this either.