jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Beginning cell edit when pressing special keys
Tagged: angular grid, bootstrap grid, javascript grid, jquery grid, jqwidgets grid, jqxgrid edit mode on key press
This topic contains 1 reply, has 2 voices, and was last updated by Christopher 8 years, 7 months ago.
-
Author
-
Hello,
We are currently setting up our grids in the following way (emphasis on edit and selection mode):
.jqxGrid({ width: 1400, source: gridAdapterC, height: 400, altrows: true, sortable: false, editable: true, <strong>editmode: 'selectedcell', selectionmode: 'singlecell',</strong> theme: theme, handlekeyboardnavigation: keyIntercept, columns: gridColumns });
Everything runs very smoothly for us, except for in one area that we cannot figure out. When we select a cell for the user (‘selectcell’, not ‘begincelledit’), they can begin typing to bring that cell into edit mode UNLESS they try beginning with a special character such as ‘.’ or ‘/’.
The ability for our users to be able to begin a cell’s edit simply by pressing one of these keys on a cell that has been selected is vital.
We have tried the approach of intercepting these keys, beginning that cell’s edit mode, and setting the cell’s value to the character pressed. The problem here is that the entire content of a cell is highlighted on cellbeginedit, and when we do this the user will overwrite the special character as they continue typing.
We learned about the jqxInput(‘selectLast’) call in another forum discussion (http://www.jqwidgets.com/community/topic/start-editing-and-cursor-to-the-end-of-a-word/). We tried this type of approach, but it appears this only works in Chrome and Opera, and we are forced to do it through a setTimeout call as timing appears to be off. We cannot get it to work in I.E or FireFox (In fact, we cannot get pure javascript to work in these two browsers either).
The first question is, can we not simply allow the cell edit to occur when the user presses these keys?
If not, the second question is, how do we manually set this up to get the results we need?
Another smaller question is, where in the API documentation is the information for the jqxInput(‘selectLast’) call?
Thanks for your time!
Hi mattcash,
For your first question:
We can allow the user to enter edit mode on any key pressed. This can be done through thehandlekeyboardnavigation
function of the jqxGrid, by calling thebegincelledit
method when a certain key is pressed.For the other question:
TheselectLast
property of the jqxInput does exactly what it suggests. It sets the input mark at the end of the string in the jqxInput text box. Unfortunately it isn’t part of the API documentation.The
selectLast
function has been tested in all popular browsers and it works in all of them ( Safari, FireFox, IE, Chrome).I modified the code that you found on the other thread to work the way you want to. Here is a link to the demo:
https://www.jseditor.io/?key=xb-jqxgrid-enter-edit-mode-on-key-pressedThe demo has been tested on the latest versions of Chrome, FireFox, MS Edge, IE11 and it works perfectly on all of them.
Best Regards,
ChristopherjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.