Forum
10:44
17/02/2012
Howdy!
I'm using jqGrid v4.3.1 and I've found that the 'afterrestorefunc' function is not called when the escape key is pressed if keys are enabled for row editing.
I also have a fix for the code, which is really simple – looks like it was just a typo in the source.
It's pretty simple to reproduce – using Row Editing Basic example on the demos, do…
var editParameters = { "keys" : true, // ENABLE KEYS (RETURN, ESCAPE) "afterrestorefunc" : function(){alert("afterrestorefunc was called!");}, // SHOW ALERT AFTER RESTORE }; jQuery("#rowed1″).jqGrid('editRow',"13″, editParameters );
Cancel the edit with the escape key – the row is restored to the pre-edit state, as expected, the the alert never appears.
The problem seems to be in line 8822 of the 4.3.1 source:
8821 if (e.keyCode === 27) {
8822 $($t).jqGrid("restoreRow",rowid, afterrestorefunc);
8823 return false;
8824 }
It should read:
8822 $($t).jqGrid("restoreRow",rowid, o.afterrestorefunc);
To elaborate, the o variable stores the options (in my example, the values in editParameter), which includes the afterrestorefunc value. The o is needed to retrieve the function – using afterrestorefunc on its own evaluates to undefined, and so it doesn't work.
I've run through the rest of the code and as far as I can tell, this is the only place this is a problem (it appears again in line 9013, for example, but it's correct there).
Hope this fix can make it in to the next release.
Cheers!
Andrew
16:22
Moderators
30/10/2007
Hello,
Thanks. This is allredy fixed:
https://github.com/tonytomov/jqGrid/commit/3ea69a09343340433daee55af069de4a6c97e0b2
Regards
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
23 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66