2017-05-19 1 views
0

テーブルライブラリで生成されるテーブルの幅と色を変更する方法は?私はCodeIgniterの中で、テーブルライブラリによって生成された色と、テーブルの幅を変更するにはどうすればよい

コントローラ

<?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>'; 
      ?> 

私は可能であれば、それぞれのために使用したいが、私ビュー内でこのライブラリから列をフェッチする方法を知らない

答えて

1

これは、Tableクラステンプレートを変更することによって行われます。 Documentation Here

特定のクラスを<table>に、もう1つをすべて<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); 
関連する問題