Bug in jquery.yiigridview.js

Hi,

After updating the Yii framework (v1.1.7), the file jquery.yiigridview.js generated an error :

Here the function :




			if(settings.selectableRows > 0) {

				$('#'+id+' .'+settings.tableClass+' > tbody > tr').live('click',function(e){

					if('checkbox'!=e.target.type){

						var $sbox=$('input.select-on-check',this);

						var sboxname=$sbox.attr('name');

						if(settings.selectableRows == 1){

							$(this).siblings().removeClass('selected');

							$("input[name='"+sboxname+"']").attr('checked',false);

						}

						$(this).toggleClass('selected');

						$sbox.attr('checked',$(this).hasClass('selected'));

						var sboxallname=sboxname.substring(0,sboxname.length-2)+'_all';	//.. remove '[]' and add '_all'

						$("input[name='"+sboxallname+"']").attr('checked', $("input[name='"+sboxname+"']").length==$("input[name='"+sboxname+"']:checked").length);

						if(settings.selectionChanged != undefined)

							settings.selectionChanged(id);

					}

				});

			}



This problem is solved by adding a test on the variable sboxname :




			if(settings.selectableRows > 0) {

				$('#'+id+' .'+settings.tableClass+' > tbody > tr').live('click',function(e){

					if('checkbox'!=e.target.type){

						var $sbox=$('input.select-on-check',this);

						var sboxname=$sbox.attr('name');

						if(settings.selectableRows == 1){

							$(this).siblings().removeClass('selected');

							if(sboxname) $("input[name='"+sboxname+"']").attr('checked',false);

						}

						$(this).toggleClass('selected');

						$sbox.attr('checked',$(this).hasClass('selected'));

						if(sboxname) var sboxallname=sboxname.substring(0,sboxname.length-2)+'_all';	//.. remove '[]' and add '_all'

						if(sboxname) $("input[name='"+sboxallname+"']").attr('checked', $("input[name='"+sboxname+"']").length==$("input[name='"+sboxname+"']:checked").length);

						if(settings.selectionChanged != undefined)

							settings.selectionChanged(id);

					}

				});

			}



But this file is located in the assets. Is it a good practice to change it?

is which browser it shows the error ?

Did you cleaned up the assets folder after the update to 1.6 ?

If you did and it is still ocurring you should post it as a bug

The browser is Mozilla Firefox 3.6.13.

Yes, I removed the assets before the update.

About changing it i dont see any problem

Yes, you should report it as a bug

May be because you have a grid view column of checkboxes (CCheckBoxColumn).

The error is generated when you click on a line.

I can confirm the bug with revision 2908 and firefox.

Anyway if firebug is disactivated all works normally, is not a blocking error.

Bug published http://code.google.com/p/yii/issues/detail?id=2037

Just fixed - http://code.google.com/p/yii/source/detail?r=2913

Thanks for reporting it…