Welcome Guest, Not a member yet? Register   Sign In
Possible to specify ID and Class to a tbale generated from the table class?
#1

For CSS I would like to apply an ID and a class to a table generated using the CI table class - how would I  do this please?
Reply
#2

@colin147,

You could create templates that use an specific ID and class when generating a table. There is an example in the documentation of how to create a template ( https://www.codeigniter.com/user_guide/l...le%20class ).
Reply
#3

(This post was last modified: 11-20-2017, 03:24 PM by dave friend.)

(11-20-2017, 06:02 AM)colin147 Wrote: For CSS I would like to apply an ID and a class to a table generated using the CI table class - how would I  do this please?

It is quite easy. You simply adjust the template used to build the table. In this example a class and id are added to the table opening tag. 

PHP Code:
$template = array(
 
       'table_open' => '<table class="fancy_table_css" id="my-cool-table" border="0" cellpadding="4" cellspacing="0">',
);
$this->table->set_template($template); 

Read all about it: Documented here.
Reply
#4

Ah, templates!  Thanks guys, I knew there was a simple answer somewhere!
Reply
#5

The best place I found to place the Table Templates is in the MY_Controller.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB