diff --git a/components/Crud.php b/components/Crud.php index 22f71e2..c35bb9d 100644 --- a/components/Crud.php +++ b/components/Crud.php @@ -127,13 +127,12 @@ public function getDataProvider($filterParams = true, $pagination = false, $rela 'class' => 'ereminmdev\yii2\crud\components\Pagination', 'storeKey' => basename($modelClass) . '-per-page', ], - 'sort' => [ - 'defaultOrder' => [ - 'id' => SORT_DESC, - ], - ], ]); + if (!empty($dataProvider->sort->getAttributeOrders())) { + $dataProvider->query->orderBy([]); + } + /** @var ActiveQuery $query */ $query = $dataProvider->query;