srun / provider
The srun4-api's ActiveDataProvider is parsed to use the GridView
1.0.1
2024-06-20 02:35 UTC
Requires
- yiisoft/yii2: ~2.0.45
This package is auto-updated.
Last update: 2025-04-20 04:21:33 UTC
README
##Srun-Provider The srun4-api's ActiveDataProvider is parsed to use the GridView
解析srun4k-api
的ActiveDataProvider
数据结构以使用 GirdView
因为接口返回 ActiveDataProvider
数据结构,而页面需要搭配 GridView
组件。
所以需要将数据源转换成DataProvider
,将 ArrayDataProvider
去掉分页逻辑。
Installation
Either run
composer require srun/provider
or add
"srun/provider":"*"
to the require section of your composer.json
file.
Usage
return new \srun\provider\ApiDataProvider([ 'allModels' => $data, /*@var array 数据源*/ 'totalCount' => $totalCount, /*@var int 总数*/ 'pagination' => [ 'pageSize' => 10, /*@var int 分页大小*/ ], ]);