Reputation: 179
As I understood when I click on the button "Confirm" pjax reload widget with new data,and started with firs paging page. 1)Is there any way to load new data but stay at current paging page? 2)Is there any way to sent 'id' parameter by POST method?
Controller
public function actionIndex()
{
$dataProvider = new ActiveDataProvider([
'query' => Orders::find()->with('orderServices.services','orderEmployees','user'),
'pagination' =>['pageSize' => 3],
]);
return $this->render('index', [
'dataProvider' => $dataProvider,
]);
}
In View
<?php \yii\widgets\Pjax::begin(); ?>
<?= GridView::widget([
// ... configuration here
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete} {approve}'
,
'buttons' => [
'approve' => function ($url,$model,$key) {
if($model->status=='not confirm')
{
return Html::a('Confirm',Url::toRoute(['controller/action', 'id' => $model->id]));/// має бути Ajax
}
},
],
]
]);
<?php \yii\widgets\Pjax::end(); ?>
Upvotes: 0
Views: 1693
Reputation: 133370
I don't if this could be useful for you but with :
Yii::$app->request->get('page')
You can obtain the current GET page in this way and use for your need
Upvotes: 1