GitHub - techlab/codeigniter-smartgrid: A simple PHP datagrid control for CodeIgniter framework with Bootstrap

SmartGrid focus on data display than data manipulation. We are starting with limited features to make the code very simple and robust, yet we will be adding more feature on the go. The code is very simple and well documented, which make it easy for customization.

// Load the SmartGrid Library
$this->load->library('SmartGrid/Smartgrid');

// MySQL Query to get data
$sql = "SELECT * FROM employee"; 

// Column settings
$columns = array("employee_id"=>array("header"=>"Employee ID", "type"=>"label"),
                "employee_name"=>array("header"=>"Name", "type"=>"label"),
                "employee_designation"=>array("header"=>"Designation", "type"=>"label")
        );        
        
// Set the grid 
$this->smartgrid->set_grid($sql, $columns);

// Render the grid and assign to data array, so it can be print to on the view
$data['grid_html'] = $this->smartgrid->render_grid();    

// Load view
$this->load->view('example_smartgrid', $data);
<!-- For styling, refer the bootstrap from CDN or from your server. 
Ignore this if you already have included in main view -->

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
// Print the grid html
echo $grid_html;