2017-05-19 2 views
0

Wie ich die Farbe und Breite der Tabelle durch Tabellenbibliothek in CodeIgniter erzeugt ändernWie ändert man die Breite und Farbe der von der Tabellenbibliothek erzeugten Tabelle?

-Controller

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

Ansicht

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

ich für jede verwenden möchten, dass, wenn möglich, aber ich Ich weiß nicht, wie ich die Spalten aus dieser Bibliothek in der Ansicht

Antwort

1

abrufen kann. Dies geschieht durch Änderung der Tabellenklassenvorlage. Documentation Here

Um eine bestimmte Klasse zum <table> und einem anderen für all <tr> s zum Beispiel hinzufügen.

$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); 
Verwandte Themen