CodeIgniter Forums
MY_Table.php - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: MY_Table.php (/showthread.php?tid=53927)



MY_Table.php - El Forum - 08-14-2012

[eluser]Unknown[/eluser]
I have updated libraries/table.php to add suppport for tfoot.

Use $this->table->add_footer().

I can't add it to a code block here (too many characters), and I can't attach the file. How best can I share this?


MY_Table.php - El Forum - 08-14-2012

[eluser]InsiteFX[/eluser]
Place it on GitHub the accounts are free.

Or you can post it on Paste bin



MY_Table.php - El Forum - 08-14-2012

[eluser]Unknown[/eluser]
Thanks, InsiteFX.

Shared at https://github.com/SilverPaladin/Codeigniter-My_Table



MY_Table.php - El Forum - 08-14-2012

[eluser]PhilTem[/eluser]
Coolio, made the same code into my project.

Nonetheless, I found one thing that is wrong in your code: A table footer has tr-td blocks and not tr-th. th is only for table-head. Therefore, if you want to have proper HTML code generation of tables, you should change the default template to

Code:
$template = array (
    'footer_row_start'   => '<tr>',
    'footer_row_end'     => '</tr>',
    'footer_cell_start'  => '<td>',
    'footer_cell_end'    => '</td>'
)

However, I like that you put the table-footer directly after the table-header and not at the end of the table Wink


MY_Table.php - El Forum - 08-23-2012

[eluser]cPage[/eluser]
How about my way for table. Its working with coordinated cells.

$this->page->set_output(block,line,column,$value1);

Code:
$this->set_thead('whatever'); //auto colspan 3
$this->set_tfoot('whatever'); //auto colspan 3
$this->set_caption('whatever');
$this->page->set_output(1,1,1,$value1);
$this->page->set_output(1,1,2,$value2);
$this->page->set_output(1,1,3,$value3);
$strHtml = $this->page->create_table(1,1,3);