Pjax with GridView timeout issue

Hello people,

I have a heavy GridView with many columns wrapped by Pjax as usual:




$pjaxId='pjax_id_1';

$gridId='grid_id_1';

Pjax::begin(['id' => $pjaxId, 'timeout'=>5000, 'options'=> ['class'=>'pjax']]);

    echo GridView::widget([

        'dataProvider' => $menuDp,

        'filterModel' => $menu,

        'options'=>['class'=>'grid-view', 'id'=>$gridId],

...



But timeout value has no any effect. The page reloaded by Pjax time to time.

JS generated and settings of Pjax seems to be correct.

There are no any errors, just timeout.

When I reduce the number of columns it works little better.

But not always even when I have only a couple of simple columns.

Yes the local server could be slow, but the question is about settings of Pjax,

because when I set timeout value directly in JS


$.pjax.reload({container:'#'+pjaxId, timeout:5000});

call it works perfect without re-loading page.

What could be wrong?

Thanks!

I am not sure whether it will work for you or not. I had same problem but putting this code works for me.


$(document).on("pjax:timeout", function(event) {

    // Prevent default timeout redirection behavior

    event.preventDefault()

});