Event for deleting a row via the context menu

Posted by: kyle.m.vassella on 11 October 2018, 5:18 pm EST

    • Post Options:
    • Link

    Posted 11 October 2018, 5:18 pm EST

    When you right click the left-most column of a spread sheets record, a context menu appears that gives you the option to ‘delete’. This deletes the row and actually removes it from the canvas.

    I’d like to know what event I can bind to this so that I can delete this row from the database as well.

  • Posted 12 October 2018, 4:27 am EST

    Hello,

    There is no direct event to know about the deleted row. However, you can handle the onOpenMenu method of Contextmenu and get to know which was deleted with “menuData” and “hitInfo” properties.

    “menuData” will tell you which option was clicked and hitInfo will give you information about which row was clicked.

    http://help.grapecity.com/spread/SpreadSheets11/webframe.html#SpreadJS~GC.Spread.Sheets.ContextMenu.ContextMenu~onOpenMenu.html

    Thanks,

    Deepak Sharma

  • Posted 12 October 2018, 2:57 pm EST

    Thanks Deepak,

    Could you type me an example of successfully calling onOpenMenu in Typescript? I’m working in an Angular 6 project and can’t make your JavaScript documentation work on my Angular application: http://help.grapecity.com/spread/SpreadSheets11/webframe.html#SpreadJS~GC.Spread.Sheets.ContextMenu.ContextMenu~onOpenMenu.html

    It would be much appreciated. Thank you!

  • Posted 17 October 2018, 9:58 am EST

    Hello Kyle,

    I have escalated this issue to the development team. I will let you know once i hear from them the tracking id for this issue is 265904.

    Thanks,

    Deepak Sharma

  • Posted 22 October 2018, 5:49 am EST

    Hello,

    Our development team suggested that you could listen to RowChanged event to know when a row is deleted instead of going through to the ContextMenu 'onOpenMenu".

    For example:

    spread.bind(GC.Spread.Sheets.Events.RowChanged, function (evt, args) {
    console.log(args.propertyName + " from: " + args.row + "; delete count: " + args.count);
    });
    

    bind the event will solve the issues.

    When deleting the row from the context menu, it will fire the row change event.

    In this event you can invoke sheet.getDeletedRows() method to get the deleted row info.

Need extra support?

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

Learn More

Forum Channels