How to know if cell is currently being edited

Posted by: nirwei on 23 November 2020, 2:51 am EST

    • Post Options:
    • Link

    Posted 23 November 2020, 2:51 am EST

    Hi,

    I’m using flexgrid 5.20203.748 on angular 9.

    I need to implement different behaviors for a ‘delete’ keypress depending on the editing mode of the cell currently in focus.

    e.g: if the cell is not in edit mode, the ‘delete’ keypress should trigger function foo(), but if the cell is in edit mode, it should trigger function bar().

    i’, already catching the ‘delete’ keypress event, but I’m not sure how to distinguish between the 2 states.

    thanks,

    Nir

  • Posted 23 November 2020, 7:52 pm EST

    Hi Nir,

    You may use the editRange property to check if a particular cell is being edited or not. Please refer to the following code snippet:

    /* check if the currently selected cell is being edited */
    function isEditing(grid, rowIndex, colIndex){
        return grid.editRange? grid.editRange.contains(rowIndex, colIndex): false;
    }
    var selection = grid.selection;
    var isEditing = isEditing(grid, selection.row, selection.col);
    

    Regards

  • Posted 26 November 2020, 3:35 am EST

    thank you sharad, this did the trick

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels