Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yii2 : how to keep the url same in kartik grid view?

Tags:

php

yii2

I am using kartik grid view to display my data in yii 2 with pjax enabled. Every time, I search a data in the grid view, the search is done using ajax but the url keeps changing. Is there a way to keep the url unchanged? Please help me with the solution. Here is my code:

<?php use kartik\grid\GridView;?>
<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'pjax'=>true,
    'pjaxSettings'=>[
        'neverTimeout'=>true,
    ],
    'columns' => [
        ['class' => 'yii\grid\SerialColumn'],

        'hotel_id',
        'name',
        'address',
        'phone_no',
        'contact_person',
        // 'email_address:email',
        // 'website',

        ['class' => 'yii\grid\ActionColumn'],
    ],
]); ?>
like image 570
Stark Avatar asked Dec 09 '14 05:12

Stark


1 Answers

You can disable pushState feature like this:

'pjax' => true,
'pjaxSettings' => [
    'options' => [
        'enablePushState' => false,
    ],
],
like image 182
arogachev Avatar answered Nov 09 '22 11:11

arogachev