|
1 | 1 | # SmartGrid for CodeIgniter with Bootstrap |
2 | | -A simple PHP datagrid control for CodeIgniter framework with Bootstrap |
| 2 | +A simple PHP datagrid control for CodeIgniter framework with Bootstrap. |
| 3 | +SmartGrid focus on data display than data manipulation. |
| 4 | +We are starting with limited features to make the code very simple and robust, |
| 5 | +yet we will be adding more feature on the go. The code is very simple and well documented, which make it easy for customization. |
| 6 | + |
| 7 | +Installation |
| 8 | +----- |
| 9 | +1. [Download](https://github.com/techlab/codeigniter-smartgrid/archive/master.zip) the source files |
| 10 | +2. Copy the folder and files `application/libraries/SmartGrid/` to `application/libraries/` folder of your CodeIgniter installation |
| 11 | +3. That's it! Start using with the examples below or at [application/controllers/Example_smartgrid.php](https://github.com/techlab/codeigniter-smartgrid/blob/master/application/controllers/Example_smartgrid.php) |
| 12 | + |
| 13 | +Example usage |
| 14 | +----- |
| 15 | +on your controller: |
| 16 | +```php |
| 17 | +// Load the SmartGrid Library |
| 18 | +$this->load->library('SmartGrid/Smartgrid'); |
| 19 | + |
| 20 | +// MySQL Query to get data |
| 21 | +$sql = "SELECT * FROM employee"; |
| 22 | + |
| 23 | +// Column settings |
| 24 | +$columns = array("employee_id"=>array("header"=>"Employee ID", "type"=>"label"), |
| 25 | + "employee_name"=>array("header"=>"Name", "type"=>"label"), |
| 26 | + "employee_designation"=>array("header"=>"Designation", "type"=>"label") |
| 27 | + ); |
| 28 | + |
| 29 | +// Set the grid |
| 30 | +$this->smartgrid->set_grid($sql, $columns, $config); |
| 31 | + |
| 32 | +// Render the grid and assign to data array, so it can be print to on the view |
| 33 | +$data['grid_html'] = $this->smartgrid->render_grid(); |
| 34 | + |
| 35 | +// Load view |
| 36 | +$this->load->view('example_smartgrid', $data); |
| 37 | +``` |
| 38 | + |
| 39 | +and then, on your view: |
| 40 | +```html |
| 41 | +<!-- For styling, refer the bootstrap from CDN or from your server. Ignore this if you alredy have included in main view --> |
| 42 | + |
| 43 | +<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> |
| 44 | +``` |
| 45 | +```php |
| 46 | +// Print the grid html |
| 47 | +echo $grid_html; |
| 48 | +``` |
| 49 | +Features |
| 50 | +----- |
| 51 | + + Simple datagrid for data display |
| 52 | + + Accepts both MySQL query and array data |
| 53 | + + Automatic Pagination |
| 54 | + + Uses Twitter Bootstrap for styling, so easy to style with any bootstrap template |
| 55 | + + No extra css or js files to include |
| 56 | + |
| 57 | +Limitations |
| 58 | +----- |
| 59 | + - Add, Edit, Del, Themes, Export, Search and Sort are not supported |
| 60 | + - Search, Sort, Themes, Export features are on pipeline |
| 61 | + - Database support: MySQL only for now |
| 62 | + - Language support: English only for now |
| 63 | + |
| 64 | +Version |
| 65 | +----- |
| 66 | +**SmartGrid v0.6.1-beta** |
| 67 | +> Notice:- SmartGrid is still on beta version, usage on production eviorment is not recommented unless tested well. |
| 68 | +> Please report issue at [github issues](https://github.com/techlab/codeigniter-smartgrid/issues/) |
| 69 | +
|
| 70 | + |
| 71 | +License |
| 72 | +---- |
| 73 | +[MIT License](https://github.com/techlab/codeigniter-smartgrid/blob/master/LICENSE) |
0 commit comments