简体   繁体   中英

Grocery CRUD always showing No items to display but shows total number grid footer

I have a problem, that I am using Grocery CRUD and when I list the data, it always shows No items to display but it shows total number of records in table

Controller

class manage_home extends CI_Controller {

public function __construct() {
    parent::__construct();

    $this->load->database();
    $this->load->helper('url');

    $this->load->library('grocery_CRUD');
 }
    public function all_intro() {
   // echo "All is well";
    $crud = new grocery_CRUD();

    $crud->set_table('tbl_home_information');
    $crud->columns('pk_information_id','information_title','information_status','information_added');
    $crud->fields('pk_information_id','information_title','information_status','information_added');

    $crud->display_as('pk_information_id','ID');
    $crud->display_as('information_title','Title');
    $crud->display_as('information_added','Date');
    $crud->display_as('information_status','Status');

    $output = $crud->render();

    $this->_example_output($output, "Manage Brands");
}
}

在此处输入图片说明 EDIT Scheme of my table is 在此处输入图片说明

Make sure the $crud->columns('pk_information_id','information_title','information_status','information_added'); are the field names of your database tables. Try adding $crud->set_primary_key('pk_information_id','"your database table name here"'); if your pk_information_id is set to primary key.

And try to declare $this->_example_output($output, "Manage Brands"); to $this->_example_output($output,'"your controller to view url"'); .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM