jQWidgets Forums

jQuery UI Widgets Forums Grid Beginning cell edit when pressing special keys

This topic contains 1 reply, has 2 voices, and was last updated by  Christopher 8 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • mattcash
    Participant

    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!


    Christopher
    Participant

    Hi mattcash,

    For your first question:
    We can allow the user to enter edit mode on any key pressed. This can be done through the handlekeyboardnavigation function of the jqxGrid, by calling the begincelledit method when a certain key is pressed.

    For the other question:
    The selectLast 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-pressed

    The demo has been tested on the latest versions of Chrome, FireFox, MS Edge, IE11 and it works perfectly on all of them.

    Best Regards,
    Christopher

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.