yii2: GridView filters and Pjax are not working correctly
I’m using Gridview widget with Pjax. Sorting works fine. But when I enter keyword in filter, it tries to submit another form on the page using POST and page refreshes (or the form shows validation errors) instead of sending GET (like sorting does). In other words Pjax/Gridview doesn’t know which form it should submit. I added ID to the grid but it didn’t help. The grid is loading dynamically in Modal window. Configuration is below:
\yii\widgets\Pjax::begin();
echo \yii\grid\GridView::widget([
'id'=>'job-gridview',
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'layout' => "{items}\n{pager}",
'columns' => [
'name',
'status',
],
]);
\yii\widgets\Pjax::end();
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 23 (4 by maintainers)
I have a solution for this
put this code for begin ajax
Pjax::begin([‘id’ => ‘admin-crud-id’, ‘timeout’ => false, ‘enablePushState’ => false,]);
mybe can help.
For those who encountered this problem. Remember too…
Did you try to set an id on Pjax ? e.g. :