Welcome Guest, Not a member yet? Register   Sign In
table->set_heading not doing anything
#2

(12-12-2015, 09:55 PM)DSMatichuk Wrote: I'm trying to use the table library and it looks very promising, however, I cant seem to modify the template. It looks simple enough. Too simple actually. I can't see anything to troubleshoot. It's just one line of code:

Code:
$this->table->set_template(array('table_open' => '<table class="table table-hover table-condensed">'));
$this->table->set_heading('id', 'Phone', 'Username', 'First', 'Last', 'Email', 'Created');
if(isset($users))
 foreach($users as $user)
    $this->table->add_row($user->id, $user->phone, $user->username, $user->first_name, $user->last_name, $user->email, $user->register_date);
echo $this->table->generate();
The above code works fine without the set_template call and adding the call makes no difference. I've also tried using set_template to change other elements and none of them do anything. Any ideas what I might be doing wrong?


You should be setting the template like this:

PHP Code:
$template = array(
 
       'table_open' => '<table border="1" cellpadding="2" cellspacing="1" class="mytable">'
);

$this->table->set_template($template); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: table->set_heading not doing anything - by InsiteFX - 12-13-2015, 04:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB