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
Binding additional keyboard events in Cell Editing mode
25/07/2014
15:56
Avatar
poff
Member
Members
Forum Posts: 3
Member Since:
21/07/2014
sp_UserOfflineSmall Offline

Hi,

Is it somehow possible to bind new keyboard events to the grid in Cell Editing mode, in addition to those that are predefined for key navigation? I've tried to use the bindKeys method, and binding a keydown event to the grid, but neither of them seem to work. Both of them work fine when cell editing is not active though.

Am I missing something here, or is it not possible to bind additional keyboard events when using cell editing?

Thank you for the excellent grid plugin!

28/07/2014
21:04
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

 

Can you please let me know what is your goal?

What you try to do - just let me know about the problem you should resolve.

 

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

29/07/2014
11:41
Avatar
poff
Member
Members
Forum Posts: 3
Member Since:
21/07/2014
sp_UserOfflineSmall Offline

tony said
Can you please let me know what is your goal?

What you try to do - just let me know about the problem you should resolve.

I would like to add the possibility for the user to navigate through grid pages with Page Up and Page Down keys. I found instructions on how to do this on this stack overflow answer, but the keydown event does not seem to fire in cell editing mode.

29/07/2014
14:35
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

I understand and this time is very easy to answer.

Since you are in celledit mode you are in a table cells.

Keydown by default can not be applied to table cells.

In jqGrid we use a trick to create a hidden div inside grid and make a keydown to it.

Currently you can look at GridNav method (which do this job in celledit mode) and make the needed changes for pageup pagedown keys.

 

Kind Regards

Tony

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.

29/07/2014
16:39
Avatar
poff
Member
Members
Forum Posts: 3
Member Since:
21/07/2014
sp_UserOfflineSmall Offline

tony said

Currently you can look at GridNav method (which do this job in celledit mode) and make the needed changes for pageup pagedown keys.

Thank you!

In case someone else is searching for a way to do this, here is what I ended up with, added to the switch statement inside GridNav function:

case 36: // Home - First page
  var pager = $($t).jqGrid('getGridParam', "pager");
  var page  = $($t).jqGrid('getGridParam', "page");

  if (pager && page !== 1) {
    $($t).jqGrid('setGridParam', { "page": 1 }).trigger("reloadGrid");
  }
break;
case 34: // Page Down - Previous page
  var pager = $($t).jqGrid('getGridParam', "pager");
  var page  = $($t).jqGrid('getGridParam', "page");

  if (pager && page > 1) {
    $($t).jqGrid('setGridParam', { "page": page - 1 }).trigger("reloadGrid");
  }
break;
case 33: // Page Up - Next page
  var pager    = $($t).jqGrid('getGridParam', "pager");
  var page     = $($t).jqGrid('getGridParam', "page");
  var lastpage = $($t).jqGrid('getGridParam', "lastpage");

  if (pager && page < lastpage) {
    $($t).jqGrid('setGridParam', { "page": page + 1 }).trigger("reloadGrid");
  }
break;
case 35: // End - Last page
  var pager    = $($t).jqGrid('getGridParam', "pager");
  var page     = $($t).jqGrid('getGridParam', "page");
  var lastpage = $($t).jqGrid('getGridParam', "lastpage");

  if (pager && page !== lastpage) {
    $($t).jqGrid('setGridParam', { "page": lastpage }).trigger("reloadGrid");
  }
break;

11/08/2014
14:46
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

 

Thanks for the feedback and the code posted.

 

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
43 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