I have included the Gridview widget in
$dataProvider = new ActiveDataProvider([
'query' => \app\models\ServiceCharges::find(),
'pagination' => [
'pageSize' => 5,
$searchModel = New \app\models\ServiceChargesSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
['class' => 'yii\grid\ActionColumn'],
I have no experience with Yii2 but if it is similar than 1..
Why are you declaring
dataProvider twice? I imagine the first one is to be able to customize page size.
So what happens is you use one data provider to set pagination but then you pass a different one to the table.
Second I don't know how your model looks inside but..
Since I can see the
search() method returns a
dataProvider, you should change the pagination inside there.
Or I think you can change it right after the
search() method returns the
$searchModel = New \app\models\ServiceChargesSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider->pagination->pageSize=5;
So you don't need the first instance of
dataProvider that you've declared before.
As for the filters I do not know how it exactly behaves your
But in Yii1 you normally:
1) Define model 2) Fill it up with data from
If filters still not work you can provide code from the model.