我有一个每 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
],
.........
]
]);
?>
关于php - 更新 Kartik 网格时隐藏加载程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39928610/