Yii Framework Forum: CGridview breaks when updating non-cgridview elements - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

CGridview breaks when updating non-cgridview elements Rate Topic: -----

#1 User is offline   szako 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 17-May 10

Posted 17 January 2011 - 06:05 AM

Hey

I use an ajax form to add items to a list on a page. After the ajax submit I update both the grid list and the select input of the form, to show only the difference between the list and the select's options.

So I used 'ajaxUpdate' property with a comma separated list to update multiple selects on my page.

r2848 broke it because it calls selectCheckedRows() on all of the items set in 'ajaxUpdate'.

The js error is settings is undefined

So I had to modify the function

	$.fn.yiiGridView.selectCheckedRows = function(id) {
		var settings = $.fn.yiiGridView.settings[id];
		$('#'+id+' .'+settings.tableClass+' > tbody > tr > td >input.select-on-check').each(function(){
			if($(this).attr('checked'))
				$(this).parent().parent().addClass('selected');
		});
	};


to this

	$.fn.yiiGridView.selectCheckedRows = function(id) {
		var settings = $.fn.yiiGridView.settings[id];
                if (settings == undefined) return;
		$('#'+id+' .'+settings.tableClass+' > tbody > tr > td >input.select-on-check').each(function(){
			if($(this).attr('checked'))
				$(this).parent().parent().addClass('selected');
		});
	};


Should this be reported as a bug?
-------------
m(o_O)m
0

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,523
  • Joined: 12-October 09
  • Location:Croatia

Posted 17 January 2011 - 07:01 AM

I sent you a PM about this... but in the meantime I committed a fix for this - http://code.google.c...e/detail?r=2882
Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   szako 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 17-May 10

Posted 17 January 2011 - 08:00 AM

View Postmdomba, on 17 January 2011 - 07:01 AM, said:

I sent you a PM about this... but in the meantime I committed a fix for this - http://code.google.c...e/detail?r=2882


Tested the fix, working.

Thanks!
-------------
m(o_O)m
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users