From 8bc08393050e4376346ce013682f994261f73593 Mon Sep 17 00:00:00 2001 From: blobt <380255922@qq.com> Date: Thu, 8 Aug 2019 17:46:40 +0800 Subject: [PATCH] =?UTF-8?q?grid=20view=20=E6=B7=BB=E5=8A=A0=E9=A1=B5?= =?UTF-8?q?=E6=95=B0=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/models/CategorySearch.php | 26 +++++++++++++--------- kcadmin/assets/AppAsset.php | 1 - kcadmin/views/category/create.php | 2 +- kcadmin/views/category/index.php | 3 +++ kcadmin/web/css/site.css | 37 ------------------------------- 5 files changed, 20 insertions(+), 49 deletions(-) diff --git a/common/models/CategorySearch.php b/common/models/CategorySearch.php index 4b2e392..c22a1d6 100644 --- a/common/models/CategorySearch.php +++ b/common/models/CategorySearch.php @@ -9,13 +9,12 @@ use common\models\Category; /** * CategorySearch represents the model behind the search form of `\common\models\Category`. */ -class CategorySearch extends Category -{ +class CategorySearch extends Category { + /** * {@inheritdoc} */ - public function rules() - { + public function rules() { return [ [['id', 'icon_type', 'sort_order', 'created_at', 'updated_at'], 'integer'], [['cat_name', 'icon', 'description'], 'safe'], @@ -25,8 +24,7 @@ class CategorySearch extends Category /** * {@inheritdoc} */ - public function scenarios() - { + public function scenarios() { // bypass scenarios() implementation in the parent class return Model::scenarios(); } @@ -38,14 +36,21 @@ class CategorySearch extends Category * * @return ActiveDataProvider */ - public function search($params) - { + public function search($params) { $query = Category::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ 'query' => $query, + 'pagination' => [ + 'pageSizeLimit' => [1, 200] + ], + 'sort' => [ + 'defaultOrder' => [ + 'id' => SORT_DESC, + ] + ], ]); $this->load($params); @@ -66,9 +71,10 @@ class CategorySearch extends Category ]); $query->andFilterWhere(['like', 'cat_name', $this->cat_name]) - ->andFilterWhere(['like', 'icon', $this->icon]) - ->andFilterWhere(['like', 'description', $this->description]); + ->andFilterWhere(['like', 'icon', $this->icon]) + ->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; } + } diff --git a/kcadmin/assets/AppAsset.php b/kcadmin/assets/AppAsset.php index 7c22300..43351e5 100644 --- a/kcadmin/assets/AppAsset.php +++ b/kcadmin/assets/AppAsset.php @@ -21,6 +21,5 @@ class AppAsset extends AssetBundle 'yii\bootstrap\BootstrapAsset', 'yii\bootstrap\BootstrapPluginAsset', 'blobt\web\AdminlteAsset', - 'blobt\web\DatatableBootstrap' ]; } diff --git a/kcadmin/views/category/create.php b/kcadmin/views/category/create.php index a727e42..48abbb7 100644 --- a/kcadmin/views/category/create.php +++ b/kcadmin/views/category/create.php @@ -14,7 +14,7 @@ $this->params['breadcrumbs'][] = $this->title;