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_TopicIcon
Event bubbling: keydown in grid w/ cellEdit: true
27/04/2010
15:22
Avatar
daniel.soneira
Vienna, Austria
New Member
Members
Forum Posts: 2
Member Since:
27/04/2010
sp_UserOfflineSmall Offline

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).ready(function(){
  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

21/04/2011
16:21
Avatar
daniel.soneira
Vienna, Austria
New Member
Members
Forum Posts: 2
Member Since:
27/04/2010
sp_UserOfflineSmall Offline

The problem still exists in version 4.0 - new line numbers in grid.celledit.js are 99 and 393.

I was hoping that the new method bindKeys would help solving the issue but the cell-edit code seems to be pretty much unchanged.

Cheers,

Daniel

On Error Resume Next

Forum Timezone: Europe/Sofia

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

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

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information