witooh / grid-dataprovider
此包的最新版本(dev-master)没有提供许可证信息。
dev-master
2013-07-30 09:19 UTC
Requires
- php: >=5.3.0
- illuminate/support: 4.0.x
This package is not auto-updated.
Last update: 2024-09-23 14:54:47 UTC
README
#Laravel Grid DataProvider#
##安装##
在 app.config 中添加
return array( 'providers'=>array( ... ... 'Witooh\GridDataprovider\GridDataproviderServiceProvider', ), 'alias'=>array( ''' ... 'JqGrid' => 'Witooh\GridDataprovider\Facades\JqGrid', ), );
##用法##
需要使用2个类
- Criteria
- JqGrid
示例
public function dataProvider() { //Create new Criteria with table name $criteria = new Criteria('Post'); //If title is not empty, it will generate sql where (AND) condition $criteria->compare('title', Input::get('title')); //If content is not empty, it will generate sql where (OR) condition $criteria->orCompare('title', Input::get('content')); //use Laravel Query Builder $criteria->query->leftJoin('comment', 'comment.post_id', '=', 'post.id'); //make the JqGrid dataprovider //Dont care of the parameter which jqgrid send to the sever //This class will detected Input by itself. //Frist param is the criteria object //Second param is primary_key for jqgrid default is 'id' //return data array return JqGrid::make($criteria, 'post.id'); }