Missing delete event listener

Posted by: davide.vago on 26 March 2020, 5:06 am EST

  • Posted 26 March 2020, 5:06 am EST

    Good morning/afternoon

    I'm currently trying to track whenever a user press the return key of the keyboard to delete a cell content but I can't find anything useful.

    I've been looking at this as well: https://www.grapecity.com/spreadjs/demos/features/workbook/spread-events/purejs

    Would you mind help me to find out a solution?
    Thanks in advance.
  • Marked as Answer

    Replied 26 March 2020, 3:52 pm EST

    Hi Davide,

    I'm little confused here, return key is not used to delete the cell contents, were you referring to the 'backspace' or 'delete' key?
    For 'backspace' key, it simply puts the cell in edit mode, so you could just handle the 'EditEnded' event and check if the cell contents are cleared.
    For 'delete' key, you may handle the 'RangeChanged' event and check if the action type is of GC.Spread.Sheets.RangeChangedAction.clear.

    Please let me know if this doesn't resolve your issue.

    Regards
    Sharad
  • Replied 2 July 2020, 4:09 am EST

    Apologies for the delay, thanks for your support.

    The solution of using RangeChanged worked fine, I would suggest to improve this documentation page: https://www.grapecity.com/spreadjs/docs/v13/online/SpreadJS~GC.Spread.Sheets.RangeChangedAction.html as the RangeChanged event does return info.action as number however there is no reference of what these numbers are referring to.

    I had to suppose that info.action: 2 means "clear"

    Thanks again
  • Replied 2 July 2020, 8:08 pm EST

    Thank you for the suggestion. I've forwarded it to the concerned team and will keep you posted with updates regarding the same. The internal tracking Id for the case is SJS-4878.
  • Replied 13 January 2021, 6:58 pm EST

    Hi,
    I want to delete characters in cell.
    Grapecity spread js not allowing to delete using backspace or delete key. I have used rangechanged event. But not working.

    Any help would be appreciated
  • Replied 14 January 2021, 12:42 am EST

    sharad.tomer said:
    Thank you for the suggestion. I've forwarded it to the concerned team and will keep you posted with updates regarding the same. The internal tracking Id for the case is SJS-4878.
    hi can you post your code. Code which I used for rangechsnged not working
  • Replied 15 January 2021, 12:09 am EST

    Hi Harsha,

    Please refer to the following code snippet for RangeChanged.


    sheet.bind(GC.Spread.Sheets.Events.RangeChanged, function (sender, args) {
    if (args.action === GC.Spread.Sheets.RangeChangedAction.clear) {
    console.log("range Cleared");
    }
    });


    >>Grapecity spread js not allowing to delete using backspace or delete key. I have used rangechanged event. But not working.

    Could please explain more about the use case that you trying to implement? so that we could have a better understanding about the issue and assist you accordingly.

    Regards
    Avinash

  • Replied 17 January 2021, 3:29 am EST

    I want to delete some characters in cell,but when I try to remove characters using backspace or delete key, characters are not getting deleted.
  • Replied 17 January 2021, 7:12 pm EST

    avinash.pathak said:
    Hi Harsha,

    Please refer to the following code snippet for RangeChanged.


    sheet.bind(GC.Spread.Sheets.Events.RangeChanged, function (sender, args) {
    if (args.action === GC.Spread.Sheets.RangeChangedAction.clear) {
    console.log("range Cleared");
    }
    });


    >>Grapecity spread js not allowing to delete using backspace or delete key. I have used rangechanged event. But not working.

    Could please explain more about the use case that you trying to implement? so that we could have a better understanding about the issue and assist you accordingly.

    Regards
    Avinash

  • Replied 17 January 2021, 7:13 pm EST

    Hi Avinash,
    Although i used RangeChanged Event,characters are not getting deleted from grapecity ui using backspace/delete key.Please help
  • Replied 17 January 2021, 9:21 pm EST

    Hi Harsha,

    SpreadJS match the Excel behavior. In Excel when we press the backEscape and delete key it deletes the content of the Cell. For deleting a character in a cell you first need to start edit mode by double-clicking on the cell and then using the backEscape key. Please refer to the following Gif that demonstrates the same. You may also refer to the following sample that demonstrates how you could make your own shortcut keys that perform some action.

    sample:https://codesandbox.io/s/zealous-bartik-skh9c?file=/index.html

    Regards
    Avinash
  • Replied 17 January 2021, 11:33 pm EST

    Hi Avinash,
    From above sandbox code i could see only difference is license file.
    Is it mandatory for backspace?
  • Replied 17 January 2021, 11:35 pm EST

    i have used below code in my react application.
    import React from 'react';
    import { IO } from '@grapecity/spread-excelio';
    import GC from '@grapecity/spread-sheets';
    import * as Constants from '../../../tools/constants/ProjectionConstants';
    import { isAdmin } from '../../../tools/util/UserUtil';
    import "@grapecity/spread-sheets/styles/gc.spread.sheets.excel2013white.css";
  • Replied 17 January 2021, 11:35 pm EST

    Am i missing any files?
  • Replied 18 January 2021, 12:01 am EST

    HI harsha,

    >> From the above sandbox code I could see the only difference is license file.
    Is it mandatory for backspace?

    License key is only required when you host the application on the server, Also make sure you register the command that will execute on the f2 key click. If the issue persist please share a small sample and steps that replicate the issue so that we could investigate it further and assist you accordingly.

    Regards
    Avinash
  • Replied 18 January 2021, 2:20 am EST

    Hi Avinash,
    I have also registered f2 command and i could see still issue persists.
    Im using grapecity/spread-sheets version 13.2.3
    Please find attachment and let me know if anything missing?
  • Replied 18 January 2021, 2:31 am EST

    Grapecity.zip
  • Replied 18 January 2021, 8:51 pm EST

    Hi Harsha,

    Thanks for the code. We have implemented the functionality from the provided code but we are still not able to replicate the issue at our end. We found that after starting the edit mode by pressing f2(custom command that we registered) the Backescape key is working fine. Please refer to the following sample and the gi of our observation and let us know if we have missed any steps/

    sample: https://codesandbox.io/s/sleepy-meninsky-zmpdq

    Regards
    Avinash
  • Replied 19 January 2021, 6:15 pm EST

    Hi Avinash,
    We have our react/react-dom versions as 16.8.6.
    After updating versions to 17.0.1,it was working.
    Thank you so much for help.
  • Replied 19 January 2021, 9:13 pm EST

    Hi Avinash,
    Can you please try with react/react-dom version 16.8.6 and let us know if it is working fr you?
Need extra support?

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

Learn More

Forum Channels