@hollanditkzn

Как сделать автообновление страницы заказа pjax?

Использовал данный пример по авообновление pjax и у меня выходит ошибка syntax error, unexpected end of file
Немного не понял в чем проблема?
<?= Html::a('<span class="glyphicon glyphicon-refresh"></span>', ['zakaz/admin'], ['class' => 'btn btn-primary btn-lg pull-right', 'id' => 'refreshButtin']) 
<?= GridView::widget([
        'dataProvider' => $dataProviderNew,
        'tableOptions' => ['class' => 'table table-bordered'],
        'rowOptions' => function($model, $key, $index, $grid){
            return['id' => 'trNew'];
        },
        'columns' => [
            [
                'attribute' => 'id_zakaz',
                'headerOptions' => ['width' => '20'],
                'value' => 'prefics',
            ],
            [
                'attribute' => 'description',
                'contentOptions'=>['style'=>'white-space: normal;'],
            ],
            [
                'attribute' => 'srok',
                'format' => ['datetime', 'php:d.m.Y'],
                'value' => 'srok',
                'filter' => DatePicker::widget([
                     'model' => $searchModel,
                     'attribute' => 'srok',
                     'inline' => false, 
                    'clientOptions' => [
                    'autoclose' => true,
                    'format' => 'yyyy.mm.dd'
                ],
                ]),
                'headerOptions' => ['width' => '70'],
            ],
            [
                'attribute' => 'oplata',
                'headerOptions' => ['width' => '50'],
            ],
            [
                'attribute' => 'id_sotrud',
                'value' => 'idSotrud.name',
            ],
        ],
    ]); ?> 
<?php $script = <<< JS
		$(document).ready(function() {
			setInterval(function(){ $("#refreshButton").click(); }, 3000);
		});
		JS;
		$this->registerJs($script); ?>

Как правильно сделать автообновление из бд?
  • Вопрос задан
  • 490 просмотров
Решения вопроса 1
qonand
@qonand
Software Engineer
1. В первой строки не закрыт тег <?=
2. Перед закрывающим JS не должно быть пробелов
<?php $script = <<< JS
    $(document).ready(function() {
      setInterval(function(){ $("#refreshButton").click(); }, 3000);
    });
JS;
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы