Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
'afterrestorefunc' function not called when editing is cancelled with escape key, plus a fix!
17/02/2012
10:44
Avatar
adlaws
New Member
Members
Forum Posts: 1
Member Since:
17/02/2012
sp_UserOfflineSmall Offline

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

21/02/2012
16:22
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information