CGridView not working in IE 8 and bellow

Hello to all this is my first post here

I am in trouble here and in desperate need for help!

I am having problem using the CGridView widget in IE8 and bellow versions.

–problem number 1 is: when I click in one of the pagers numbers (to change to the next results) the GridView content disappear.

–problem number 2 is: I need that the gridview keep refreshing via ajax so I set up the following code:


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

    	        	            var t = self.setInterval(\"$.fn.yiiGridView.update('pool-grid')\", 7000);

    	        	        ", CClientScript::POS_LOAD);

code above works fine in firefox, chrome, opera and IE9 but not in IE7 and neither in IE8.

I looked at the following posts in this forum that are similar to my problem:

post 1

post 2

post 3

I tried the solution in the first post but nothing worked.

I double checked the versions that are being loaded by the browser:

Yii framework is 1.1.10 (I also tried in 1.1.8 and the problem persists)

Jquery is 1.7.2 ( I also tried with 1.7.1 and the problem persists)

I tried tweaking the file yii-1.1.10/framework/zii/widgets/assets/gridview/jquery.yiigridview.js

Code bellow is the one that starts at line number 80 in the original jquery.yiigridview.js


							if (settings.ajaxUpdate.length > 0) {

					//original is commented just bellow:

//					$(document).on('click', settings.updateSelector, function () {

						//bellow is hack

					$(document).on('change', settings.updateSelector, function () {

						$('#' + id).yiiGridView('update', {url: $(this).attr('href')});

						return false;

					});

				}

			//BELLOW is the original	

//				$(document).on('change', inputSelector, function () {

//following line added by CANELAS to try to deal with bug in IE:

//				$(document).on($.browser.msie? 'click': 'change', inputSelector, function () {

					$(document).on('click change', inputSelector, function () {

					var data = $(inputSelector).serialize();

					if (settings.pageVar !== undefined) {

						data += '&' + settings.pageVar + '=1';

					}

					$('#' + id).yiiGridView('update', {data: data});

				});

				

//bellow lines is hack to make work in IE but does not works				

				/*

				if($.browser.msie || $.browser.opera) {

					$(document).on('click', inputSelector, function(event){

							var data = $(inputSelector).serialize();

							if (settings.pageVar !== undefined) {

								data += '&' + settings.pageVar + '=1';

							}

							$('#' + id).yiiGridView('update', {data: data});               	

					}

				}

//					*/

				/*

				if($.browser.msie ) {

					$(document).on('keypress', inputSelector, function(event){

						if(event.keyCode == 13) {

							var data = $(inputSelector).serialize();

							if (settings.pageVar !== undefined) {

								data += '&' + settings.pageVar + '=1';

							}

							$('#' + id).yiiGridView('update', {data: data});               	

						}

					}

				}

//					*/

Anyone has any idea? help would be greatelly apreciated!

Well i have experienced the same problem as you are facing now.Any you know what that was a very small issue there And which is related to HTML.;)

There was an issue of Div tag mistmatch in the html that is why CgridView was not working in IE8 browser and below.I have spend my most of the time but mdomba sir suggested me to test a Cgrid view in fresh setup of Yii with all browsers then with your HTML in all browsers.

You will see that Fresh setup of Yii with Cgrid view will work fine and your HTMl with CgridView will not work as you are saying.

So, my suggestion here is to check your HTMl first and remove other code from that and try to debug the code by Adding a CgridView in that HTML.;)

[size=2]Hey Jayant! thanks for the tip this totally solved my problem![/size]

Cheers :lol:

Thx! I had the same problem, an unclosed <div> was the evil.

;)