Jquery Not Working In Ie

Hello EveryOne,

I am using the below GridUpdate code to Update the grid after 3 seconds’ interval.

Yii::app()->clientScript->registerScript(‘autoupdate-phonebook-grid’,

"


setInterval(function(){


	$.fn.yiiGridView.update('phonebook-grid',{ 


		data: function() {


		  $(this).serialize();


		}


	});


},3000);


"

);

The Code of the Grid is Below:

$this->widget(‘zii.widgets.grid.CGridView’, array(

'id'=>'phonebook-grid',


'dataProvider'=>$model->search(),


'filterPosition'=>'',


'columns'=>array(


	'pb_id',


	'pb_usr_id',


	'pb_del',


),

));

But when I am running this page in the IE, it Loads First Time fine, but when the grid is refreshed the page becomes empty. i.e. The grid refresh doesn’t work fine in IE.

So, Please help me out with this Problem.

Hello EveryOne,

I am facing one problem while loading my page in IE. It is working fine in mozila, chrome, safari.

I am refreshing my grid using following registerScript.

Yii::app()->clientScript->registerScript(‘autoupdate-test-grid’,

"


setInterval(function(){


	$.fn.yiiGridView.update('test-grid',{ 


		data: function() {


		  $(this).serialize();


		}


	});


},3000);


"

);

While debuging i found "$(this).serialize();" function is not being called in IE.

So after 1st refresh grid becomes empty.

Please help me guys.

Hii,

I have developed a page in which I have written jquery to refresh Cgrid at particular interval. It is working fine in all browser except Internet Explorer.

Yii::app()->clientScript->registerScript(‘autoupdate-user-grid’,

"


setInterval(function(){


	$.fn.yiiGridView.update('user-grid',{ 


		data: function() {


		  $(this).serialize();


		}


	});


},3000);

");

Eagerly waiting for your reply!!!

Hii

Can anyone guide me that how to refresh CGridview at every 5 seconds. Only grid should be refreshed.

Thanks in Advance!!!




setInterval(function() {

     $('#grid').yiiGridView('update');

}, 5000);



Thanks for your try!!

It is not Working in Internet Explorer.

Hello everyone,

Checking in more detail i found that issue is not in RegisterScript. my grid is having 15 rows and i have set pagination for 10 rows. If i change the page then also grid is getting empty. 5 rows are not being displayed.

try this


<?php 

$gridId='your-grid-id';

?>


<script>

$(window).load(function() {

     setInterval(function() {

            $('<?php echo $gridId?>').yiiGridView('update');

        }, 5000);

});

 </script>

also try this

1)defind the


'afterAjaxUpdate' => 'startRefresh', /* important */

2)


<?php

Yii::app()->clientScript->registerScript('grid-update', "

var timer = setTimeout(refresh, 10000);

function startRefresh(id, data) {

        clearTimeout(timer);

        timer = setTimeout(refresh, 10000);

}

function refresh(){

        $.fn.yiiGridView.update('active-device-grid');

}

/* cancel timer on clicks on sorters on the header */

$('#active-device-grid').on('click', 'th a', function(){

        clearTimeout(timer);

});

");

?>

check this FORUM

I have tried so many ways but it is not working.

But now i found that there should be some issue in CGridview because when I go to the next page at that time whole grid disappeared. So can you please guide me that what can be the issue for that Grid??

I have used YII default CGridview.

Hello All,

While Debug the Issue, I found that The problem is not within the Refresh function.

But the Problem is in the Yii Grid, which is not working well in IE.

Because when I remove the refresh code and then going to another page in IE still it is not displaying Grid on that page.

So , please if anyone have idea about this grid please help me out.

try this


<?php

Yii::app()->clientScript->registerScript('grid-update', "

var timer = setTimeout(refresh, 10000);

function startRefresh(id, data) {

        refresh()

        timer = setTimeout(refresh, 10000);

}

function refresh(){

        $.fn.yiiGridView.update('active-device-grid');

}

/* cancel timer on clicks on sorters on the header */

$('#active-device-grid').on('click', 'th a', function(){

        refresh()

});

");

?>

Hi, have a look at this and see if it helps.

Thanks BlkRaven.

But still it is not working fine in the IE.

Whenever I am moving to the next page the grid is disappeared.

Have you tested your code with any other browser?

Remove the setInterval function from the page, does gridview work? Does it work with other browsers?

If you are refreshing your gridview every three seconds and also trying to go to the next page, I would expect a conflict to occur at some point.

[color="#FF0000"]/* several topics has been merged into one, because they are posted by the same person on the same subject */[/color]

@khush@l, Jay Raval and kashyap

Don’t do it anymore, or you’ll be banned from the forum.

Sorry for this!!!

When we write "ajaxUpdate=false" in gridview at that time gridview is working well… But the whole page is getting refreshed at every 5 seconds. But we want that only gridview content should be refreshed. So we need some help that only CGridview getting refreshed and worked fine in Internet Explorer.