Answer the question
In order to leave comments, you need to log in
How to force PJAX to update on a timer?
How to make PJAX update in YII2 by timer? In reality the gridview is updated 2 times per second. What am I doing wrong?
<?php Pjax::begin(['id' => 'pjax-grid-view', 'timeout' => 60000]); ?>
<?php
$script = <<< JS
$(document).ready(function() {
$.pjax.reload({container: '#pjax-grid-view', timeout:false})
});
JS;
$this->registerJs($script);
?>
////все остальное
<?php Pjax::end(); ?>
Answer the question
In order to leave comments, you need to log in
By example:
<?php Pjax::begin([
'id' => 'list-messages',
'enablePushState' => false,
'formSelector' => false,
'linkSelector' => false,
]) ?>
<?= $this->render('_list', ['dataProvider' => $dataProvider, 'pages' => $pages,]) ?>
<?php Pjax::end() ?>
<?php $this->registerJs(<<<JS
function updateList() {
$.pjax.reload({container: '#list-messages'});
}
setInterval(updateList, 150000);
JS
); ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question