So I have a dataprovider which is created in a controller like this:
$modelSearch = new SearchModel();
$data_provider = $modelSearch->search(Yii::$app->request->queryParams); // returns the data provider
Then I use the $data_provider in a view like this:
GridView::widget([
'dataProvider' => $data_provider,
'export' => false,
'columns' => [
...
],
...
But now I'd like to use the same data from the $data_provider but without pagination and other sorting specifications.
Tried this but doesn't work:
$data_provider->sort = ['defaultOrder'=> ['column_a' => SORT_ASC, 'column_b' => SORT_DESC]]
$data_provider->pagination = false;
I think that's because the data is already retrieved with the ->search()
method. Do I need to create a whole new search model class? just to get a different sorting?
Thanks in advance!