Welcome Guest, Not a member yet? Register   Sign In
Table Class is missing <thead> and <tbody> options
#1

[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
#2

[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
#3

[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.
#4

[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);
#5

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




Theme © iAndrew 2016 - Forum software by © MyBB