PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, February 20, 2022

[FIXED] Hiding the loader when updating kartik grid

 February 20, 2022     php, yii     No comments   

Issue

I have a grid that gets updated every 3 seconds. Everything working fine but the problem is that the loader (showing...loading) keeps on poping up everytime the grid is updated.

This is what I have tried:

  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'],
    ]
]);

?>

Then after the grid I have:

<?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);
?>

How can i hide the loader?


Solution

I found out that i needed to set loadingCssClass to false

That is

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

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

 ?>

From Kartik documentation here on pjax settings



Answered By - Geoff
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing