Completed
Last Updated: 04 Feb 2021 00:31 by ADMIN
Release 2.22.0
Roland
Created on: 04 Aug 2020 09:52
Category: Grid
Type: Bug Report
1
OnCancel does not fire when escaping out of Inline Editing

When I have a Navigable grid and I press Esc on the keyboard while editing/inserting a row, I want to do something (e.g., clean up the newly inserted row altogether from the data). Usually, I can use the OnCancel event for this, but it does not fire when pressing the Esc key on the keyboard.

*** Thread created on customer behalf by admin ***

2 comments
Roland
Posted on: 04 Aug 2020 11:23

>OnStateChangedHandler

Yep. That did the trick.

ADMIN
Marin Bratanov
Posted on: 04 Aug 2020 09:59

Hi Roland,

Once the Add button is pressed you basically have an item in edit mode, which is an EditItem in the grid state. So, you can track the operations of the user and determine whether you want to do something after they have initiated insertion or editing, and that item becomes null, something like this snippet below.

Note that the edit item will become null when Save/Update is pressed too, which is not a cancel operation, so you may want to keep a more careful track of what the user did in order to write up the exact logic you want.

 

    async void OnStateChangedHandler(GridStateEventArgs<SampleData> args)
    {
        if(args.PropertyName == "EditItem" && args.GridState.EditItem == null)
        {
            Console.WriteLine("done editing");
        }
    }

 

 

 

 

 

Regards,
Marin Bratanov
Progress Telerik