Welcome Guest, Not a member yet? Register   Sign In
Codeigniter HTML Table class
#1

[eluser]condoace[/eluser]
I am using the table class alongside the AJAX pagination class. In my code I am displaying the data from the database via the $this->table->generate method, there are a total of 7 columns.

However I want to have 8 columns, i.e. I want to add a checkbox (with a dynamic value) for each row, how do I do this?

I have created the heading for the column using $this->table->set_heading().. but how do I add it to the $this->table->generate method?

CONTROLLER

Code:
$config['total_rows'] = $this->model_admin->num_rows();
  
   $config['per_page'] = $limit;
  
   $this->jquery_pagination->initialize($config);

   $this->load->library('table');
  
   $tmpl = array ( 'table_open'  => '<table border="0" cellpadding="2" cellspacing="1" width="100%" class="main_awesome_row">',
          
       'heading_cell_start'  => '<th class="main_awesome_header">',
                      
       'heading_cell_end'    => '</th>',

         );

   $this->table->set_template($tmpl);
  
   $this->table->set_heading('ID', 'First Name', 'Surname', 'Email','Credits','Job Title','Department','Select');
  
   $db4 = $this->model_admin->content($limit, $offset);
  
   $html = $this->table->generate($db4).'<br/><span class="pagination">'.$this->jquery_pagination->create_links().'</span>';

   echo $html;




Theme © iAndrew 2016 - Forum software by © MyBB