Fn.yiigridview.update

I want to ask does fn.yiiGridView.update render the entire page when called or just grid view table?

Hi,

it will only update the CGridview bcoz u r specifying the grid id inside the update function.

$.fn.Yiigridview.update(‘grid id’);

Hi Prat

I does render the whole page and some javascript magic to update the grid.

Set the ajaxUpdate property

ok currently I am calling fn.yiigridview.update after every 10 seconds to update cgridview. Is it possible that cgridview is updated only when some changes takes place in database.


<?php

$page_refresh_time = 10000;

Yii::app()->clientScript->registerScript('refresh_page', "interval;

function refreshGrid(){

if($('a[href=\"#dash2\"]').is(':visible')) {

 $.fn.yiiGridView.update(\"group-grid\");}}

var interval = setInterval(refreshGrid, $page_refresh_time);");

?>

Hi,

Dont refresh for every 10seconds…instead check the difference between database and cgridview records for every 10seconds. If its differ then refresh your cgridview.

You can compare the activerecords using below code

http://www.yiiframework.com/forum/index.php/topic/10285-how-to-compare-two-active-record-models/

Thanks to thyseus for his solution

Thanks

chandran nepolean