如何更改表格库生成的表格的宽度和颜色?
问题描述:
我怎样才能改变由表库所产生的颜色和表格的宽度笨如何更改表格库生成的表格的宽度和颜色?
控制器
<?php
class Addbalance extends CI_Controller{
function index(){
if($this->session->userdata('logged_in')){
$this->load->library('pagination');
$this->load->library('table');
$config['base_url']='http://localhost/elvan/addbalance';
$config['total_rows'] = $this->db->get('products')->num_rows() - 1;
$config['per_page']=1;
$config['num_links']=10;
$config['use_page_numbers'] = TRUE;
$config['first_link'] = 'First';
$config['last_link'] = 'Last';
$this->pagination->initialize($config);
$data['records']=$this->db->get('products',$config['per_page'],$this->uri->segment(2));
$this->load->model('Addbalance_m');
$this->load->view('addbalance_v',
array('order'=>$this->Addbalance_m->index(),
'provider'=>$this->Addbalance_m->get_provider_data()
,'mydata'=>$data
));
}
else {
redirect('login','refresh');
}
}
}
?>
查看
<?php
$this->table->set_heading('id','product name','quanity','yoo','yoo');
echo $this->table->generate($mydata['records']);
echo '<div id="pagination">'.$this->pagination->create_links().'</div>';
?>
我想如果可能使用每一个,但我不知道如何从视图中获取该库中的列
答
它通过修改Table类模板完成。 Documentation Here
例如,向<table>
添加一个特定的类,并向所有的<tr>
添加另一个类。
$template = array(
'table_open' => "<table class='my-table-class' id='my-fancy-table'>",
'row_start' => "<tr class='my-row-class'>",
);
//apply the above to the table
$this->table->set_template($template);