I am using CI 2.1.0 with HMVC. I am going to implement pagination in view part. But I get 'Undefined table data' error. It displays paging number (1,2,3,..) but does not display records.
My code is :
included library for pagination : $this->load->library('table');
controller
$data['title'] = "Test Events";
$this->load->library('pagination');
$config['base_url'] = 'http://localhost/myproject/index.php/events/test/';
$config['total_rows'] = $this->eventModule->countRow();
$config['per_page'] = '3';
$this->pagination->initialize($config);
$config['records'] = objectsIntoArray($this->eventModule->get_record($config['per_page'], $this->uri->segment(3)));
$data['main_content'] = 'test';
$this->load->view('event/template', $data);
view
<?php echo $this->table->generate('records'); ?>
<?php echo $this->pagination->create_links(); ?>
Thank you for support.
Finally I get the solution. It's silly mistake at
$config['records'] = objectsIntoArray($this->eventModule->get_record($config['per_page'], $this->uri->segment(3)));
It should be $data instead of $config
$data['records'] = objectsIntoArray($this->eventModule->get_record($config['per_page'], $this->uri->segment(3)));