Welcome Guest, Not a member yet? Register   Sign In
Undefined table data
#1

[eluser]npCoda[/eluser]
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:

Code:
$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'] = 'displaytest';   // view page    
$this->load->view('event/template', $data);

view

Code:
<?php echo $this->table->generate('records'); ?>
<?php echo $this->pagination->create_links(); ?>


Thank you for your support.
#2

[eluser]npCoda[/eluser]
Finally I get the solution. It's silly mistake at

Code:
$config['records'] = objectsIntoArray($this->eventModule->get_record($config['per_page'], $this->uri->segment(3)));

It should be $data instead of $config

Code:
$data['records'] = objectsIntoArray($this->eventModule->get_record($config['per_page'], $this->uri->segment(3)));




Theme © iAndrew 2016 - Forum software by © MyBB