Welcome Guest, Not a member yet? Register   Sign In
help with table + pagination
#4

[eluser]e.abubakr89[/eluser]
Hello all

I have found my solution
:lol: :lol: :lol:

by do not passing the $records directly to table.generate() function

but firstly I have to use table.add_row() function and set what I need
for example
I set my controller as

Code:
function outbox()
    {

          $this->load->library('table');
        $this->load->library('pagination');

        $config['base_url'] = 'http://localhost/we_hona/index.php/private_messages/outbox';

         $this->db->where('from',$this->input->post('session_username'));
        $config['total_rows'] = $this->db->get('pm')->num_rows();
        $config['per_page'] = 3;
        $config['num_links'] = 5;
        $config['full_tag_open'] = '<div id="outbox_pages">';
        $config['full_tag_close'] = '</div>';

        
        $this->pagination->initialize($config);

        $this->db->where('from',$this->input->post('session_username'));
        $records = $this->db->get('pm', $config['per_page'], $this->uri->segment(3));
        foreach ($records->result() as $item)
        {
            $q[] = $item;
        }
        $data['records'] = $q;
        
        $this->load->view('outbox_2',$data);

    }

then go to outbox_2 view and using foreach to execute $records record by record to pass it to table by table.add_row , and I can specify how message td will display
Code:
&lt;?php
foreach ($records as $item)
{
   $this->table->add_row(array($item->from,$item->to,$item->title,"<a >id."' >".substr($item->message,0,8)." </a>"));
}

echo $this->table->generate();
?&gt;

I dont know why code editor remove the href of my code

===========================

thanks for all who helped me

goodbye


Messages In This Thread
help with table + pagination - by El Forum - 09-22-2010, 10:04 AM
help with table + pagination - by El Forum - 09-22-2010, 10:45 PM
help with table + pagination - by El Forum - 09-22-2010, 11:03 PM
help with table + pagination - by El Forum - 09-22-2010, 11:30 PM
help with table + pagination - by El Forum - 07-19-2011, 02:12 AM
help with table + pagination - by El Forum - 07-19-2011, 06:26 AM
help with table + pagination - by El Forum - 07-19-2011, 07:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB