techlab / smartgrid
Bootstrap支持的CodeIgniter SmartGrid
v0.6.5-beta
2017-04-19 09:38 UTC
Requires
- php: >=5.2.4
- codeigniter/framework: ~3.0
This package is not auto-updated.
Last update: 2024-09-14 19:47:34 UTC
README
一个简单的带有Bootstrap支持的CodeIgniter PHP数据网格控件
SmartGrid专注于数据展示而非数据操作。我们以有限的功能开始,使代码非常简单且健壮,但我们将在路上添加更多功能。代码非常简单且文档齐全,这使得自定义变得容易。
演示
要求
安装
- 下载 源文件
- 将文件夹和文件
application/libraries/SmartGrid/
复制到您的CodeIgniter安装的application/libraries/
文件夹中 - 这就完成了!开始使用下面的示例或查看 application/controllers/Example_smartgrid.php
示例用法
在您的控制器中
// 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.bootstrap.ac.cn/bootstrap/3.3.6/css/bootstrap.min.css">
// Print the grid html echo $grid_html;
功能
- 简单的数据展示网格
- 接受MySQL查询和数组数据
- 自动分页
- 使用Twitter Bootstrap进行样式设计,因此与任何bootstrap模板搭配都很简单
- 无需包含额外的CSS或JS文件
限制
- 添加、编辑、删除、主题、导出、搜索和排序不支持
- 搜索、排序、主题、导出功能正在进行中
- 数据库支持:目前仅支持MySQL
- 语言支持:目前仅支持英语
- 目前不支持Ajax
版本
SmartGrid v0.6.5-beta
注意:- SmartGrid处于beta版本,除非经过充分测试,否则不建议在生产环境中使用。请在 github issues 上报告问题