php - 更新 Kartik 网格时隐藏加载程序

标签 php yii

我有一个每 3 秒更新一次的网格。一切工作正常,但问题是每次更新网格时,加载程序(显示...正在加载)都会不断弹出。

这是我尝试过的:

  echo DynaGrid::widget([
    'columns' => $columns,
    'showPersonalize' => true,
    'options' => ['id' => 'trackyard'],
    'gridOptions' => [
        'options' => ['id' => 'assignsolicitation-inside'],
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'showPageSummary' => false,
        'pager' => [
            'firstPageLabel' => 'First',
            'lastPageLabel' => 'Last',
            'maxButtonCount' => 10,
        ],

        'toolbar' => [
            ['content' => '{dynagrid}'],
            '{export}',
            '{toggleData}'
        ],
        'pjax' => true,
        'pjaxSettings' => [
            'options' => [
                'id' => 'wod'
            ],],
        'bordered' => false,
        'striped' => true,
        'condensed' => true,
        'responsive' => true,
        'responsiveWrap' => false,
        'containerOptions' => ['style' => 'overflow:scroll'],
    ]
]);

?>

然后在网格之后我有:

<?php
  $script = <<< JS
function reloadgrid() {
var intervalID = setInterval(function() {
   $.pjax.reload({container:'#trackyard-pjax'});
}, 3000);
setTimeout(function() {
    clearInterval(intervalID);
}, 18000);
};

reloadgrid();
JS;
$this->registerJS($script, \yii\web\VIEW::POS_HEAD);
?>

如何隐藏加载程序?

最佳答案

我发现我需要将loadingCssClass设置为false

那就是

echo DynaGrid::widget([
'columns' => $columns,
'showPersonalize' => true,
'options' => ['id' => 'trackyard'],
'gridOptions' => [
    'options' => ['id' => 'assignsolicitation-inside'],
    ....


    'pjax' => true,
    'pjaxSettings' => [
        'options' => [
            'id' => 'wod'
        ],
      'loadingCssClass'=>false,  //this disables the loading thing

      ],
    .........
   ]
  ]);

 ?>

来自Kartik documentation here on pjax settings

关于php - 更新 Kartik 网格时隐藏加载程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39928610/

相关文章:

php - 调用未定义函数 pcntl_fork() php-fpm nginx

php - 在 Windows 上安装 Composer 时出现 SSL 错误

php - 从逗号分隔中查找匹配的关键字

php - Laravel 无法显示图像

JavaScript 不工作(不显示警告框)

php - 在 Yii 框架中登录后重定向页面

php - Yii 将其他扩展与 dcclassified 合并

php - 在帖子中使用 jQueryUI Sortable

php - Yii 如何从数据库中检索数据并在 View 中显示

php - Yii - 如何提交表单并将用户发送到给定的 anchor ?