How to control table width in code ignator?
In codeIgnator frame work the below is my code working properly.But i cannot control the table width. So,when a long value come into the table then table going to extra large width.But i need to wrap the outcomes data.So,How i can fixed the table width? Pls see my code below..
///controller code///
$config['base_url'] = base_url().'Search_Controller/songSearchPage/';
$config['total_rows'] = $this->db->count_all('tbl_rbt');
$config['per_page'] = '5';
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$this->pagination->initialize($config);
//load the model and get results
$data[]=array();
$data['extraHeadContent'] = '<script type="text/javascript" src="' . base_url() . 'js/song_search.js"></script>';
$data['results'] = $this->search_model-&g开发者_开发百科t;getSongResult($config['per_page'],$this->uri->segment(3));
// load the HTML Table Class
$this->table->set_heading('Song Name','Album Name','Artist Name');
// load the view
$this->load->view('song_search_page',$data);
/////view code/////
<div class="song_element_output">
<?php echo $this->table->generate($results); ?>
<?php echo $this->pagination->create_links(); ?>
</div>
Could anybody can help me to control the table???
Thanks Riad
The table class in codeigniter doesn't support widths and other attributes for the table itself, or for the table cells.
Your options are: Extend the native table library or just create your tables the old fashioned way in your view.
I solve the problem.i use a css file to control the table width.
In which div i use the table generator short tag ...table->generate($results); ?>... i use the css on that div. Let say i use the short tag on div song_element_output then my css will be:
div.song_element_output table
{
width:620px;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
border-collapse: collapse;
border: 1px solid #777;
}
that's it.
Example of my code:
<div class="song_element_output">
<?php echo $this->table->generate($results); ?>
<?php echo $this->pagination->create_links(); ?>
</div>
Thanks to all Riad
精彩评论