Batch Edit and Keyboard Navigation

7 posts, 0 answers
  1. Albert Shenker
    Albert Shenker avatar
    573 posts
    Member since:
    Mar 2004

    Posted 29 Dec 2016 Link to this post

    I notice when I have Batch edit and Keyboard navigation, that hitting the ESC key fires the OnBatchEditCellValueChanging event if the value in the editor has changed. I handle this event to process the changed info, but I would think hitting the ESC key would cancel out of any changes. Otherwise, there really doesn't appear to be any way to prevent a changed status once any of the text has been modified.

    IMO the ESC key should cancel any changes and take the cell/row out of edit mode without any changed values. Your thoughts? Is there any way to circumvent this behavior? Obviously, if the value is changed, I want to capture that in all instances... except when a user hits the ESC key.

  2. Eyup
    Admin
    Eyup avatar
    3320 posts

    Posted 03 Jan Link to this post

    Hello Albert,

    Yes, your reasoning is absolutely right. But isn't the keyboard navigation with Batch editing mode working that way on your side? As you can see here Enter key should change the value, however, ESC should return the value to its original state:
    http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx

    Regards,
    Eyup
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Albert Shenker
    Albert Shenker avatar
    573 posts
    Member since:
    Mar 2004

    Posted 03 Jan in reply to Eyup Link to this post

    As I mentioned, I am handling the OnBatchEditCellValueChanging event to process changes. The reason I do this, is I am taking the "batch" out of batch editing and simply using the batch-editing interface to perform client-side editing. When cells are changed, the info is updated immediately through a webservice without the need to click on a button to submit all changes. When I do this, I need to return the cell to its original unedited state after the update is made (ie get rid of the red triangle indicating a change was made). So I handle the event, update the data through the webservice and use the BatchEditigManager._tryCloseEdits function to set things back to their initial state.

    Anyhow, my issue is the OnBatchEditCellValueChanging event gets fired when the user presses ESC if any changes were made in the editor. This doesn't seem to make sense since ESC is designed to cancel any changes. IMO, this event should not fire in response to the ESC key being pressed. You may want to make that change in future versions of the controls. In the meantime, is there any way to capture this keypress inside that event so I can prevent the update from occurring?

  4. Eyup
    Admin
    Eyup avatar
    3320 posts

    Posted 06 Jan Link to this post

    Hello Albert,

    Here is a possible solution:
    <ClientSettings>
        <ClientEvents OnBatchEditCellValueChanging="GridBatchEditCellValueChangingHandler_CSDC" OnKeyPress="keyPress" />
    </ClientSettings>
    JavaScript:
    var keyCode = -1;
    function keyPress(sender, args) {
         keyCode = args.get_keyCode();
    }
    function GridBatchEditCellValueChangingHandler_CSDC(sender, args) {
        if (keyCode != 27) {
            alert("Execute custom logic");
        }
    }

    Regards,
    Eyup
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. Albert Shenker
    Albert Shenker avatar
    573 posts
    Member since:
    Mar 2004

    Posted 06 Jan in reply to Eyup Link to this post

    Thanks, that worked. A couple questions...

    1) I think the keyCode property is being deprecated (according to https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode)

    can I assume your underlying get_keyCode() function will begin using the new property (.key, I think) instead whenever it is introduced.

    2) In general I think KeyPress is also being frowned upon and replaced by KeyDown. Will you be implementing such an event for the grid?

    3) You may want to build it into the grid so that the ESC key cancels out of some of these events firing (like BatchEditCellValueChanging). Or, provide an example on your site. It would seem more intuitive. the ESC should be like a "Cancel" out of the box.

  6. Angel Petrov
    Admin
    Angel Petrov avatar
    1044 posts

    Posted 11 Jan Link to this post

    Hello,

    Regarding your points.
    1) We will need to alter our internal logic so that the new key property is reflected. However we should carefully plan this in order to make the transition smoother.

    2) We do use keydown but only internally (for keyboard navigation). If you want from us to expose a public handler for the event I suggest logging a feature request in our feedback portal.

    3) This seems like a good feature request too. I suggest logging it as well. That way our developers will examine the case and improve the functionality for a future release.

    Regards,
    Angel Petrov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  7. Albert Shenker
    Albert Shenker avatar
    573 posts
    Member since:
    Mar 2004

    Posted 11 Jan Link to this post

    I have posted the requests in the feedback portal
Back to Top