dckurushin
(Diavolonok)
October 9, 2011, 12:42am
1
there is CGridView multiple confirm and data send issue
issue described here
http://www.yiiframework.com/forum/index.php?/topic/20048-multiple-delete-confirmations-with-cgridview-delete-button/
if you read this (the end of it) http://www.alfajango.com/blog/exploring-jquery-live-and-die/
you will understand that I cant do die to the function…
so if I load the CGridView via ajax, it will add the click event every time… and after some time I get handred of them…
I think the best is to go from live to delegate…
just playing now trying to figure out how to kill previus live(‘click’) or deleegate (“a.delete”, “click”
if I figure out something I will post
figured out how to solve it
in CButtonColumn replace
$js[]="jQuery('#{$this->grid->id} a.{$class}').live('click',$function);";
with
$js[]="if(jQuery('body').attr('deleteEventIsset') !== 'yes'){jQuery('body').attr('deleteEventIsset', 'yes');jQuery('#{$this->grid->id} a.{$class}').live('click',$function);}";
you can add to the attribute the grid id or something also…
tested it… it solved my issue
There is also issue like that in the pagination… it add every page load via ajax and after some time for going from page 1 to 2 it will do 100 requests
CGridView works very bad inside a div after inserted via ajax…
the first time it loaded it is ok, but after some times it add up all the events and become a mess…
I actually considering using iframe instead of div…
Too much issues …
Moderators: I think this topic place is inside bugs