Forum
15:22
27/04/2010
Hello jqGrid developers,
My environment:
- Firefox 3.6.3
- jQuery 1.4.2
- jqGrid 3.6.4
I want to handle a keyboard-shortcut (CTRL+N) to add a new row to a grid.
To do that I've setup an event delegation similar to the following:
jQuery(document).delegate('.ui-jqgrid','keydown', function(event){
if (event.ctrlKey && event.which == 78) {
// prevent opening a new window
event.stopImmediatePropagation();
event.preventDefault();
grid_add_row(); // code itself works fine
return false;
}
});
});
There are two places in grid.celledit.js that prevent this from working correctly:
The first deals with keyboard input when in celledit-mode:
line 99 – e.stopPropagation();
The second comes into play when navigating the grid with the keyboard:
line 392 in function GridNav() – return false;
Both cancel the event bubbling so that my handler is not invoked correctly. This is done regardless of which key was pressed.
I guess stopping the event to bubble is OK for some specific keys that are handled in these two methods (like ESC, ENTER, TAB) but is there a reason that you generally don't allow the event propagation in case of other keys?
If my description of the problem is somewhat not clear I would gladly provide a test case to demonstrate it.
Kind regards,
Daniel
PS: Thanks for putting so much effort into making this great grid plugin.
On Error Resume Next
Most Users Ever Online: 715
Currently Online:
29 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