Not able to edit the cell which is active by default after opening the sheet

Posted by: aditya.chauhan on 2 May 2024, 5:42 pm EST

  • Posted 2 May 2024, 5:42 pm EST

    I have a sheet which after opening it I am not able to edit the cell directly. I have to explicitly click the cell to enter some value. Please tell me some way to directly without clicking on the sheet to edit the cell or type directly into it

  • Posted 2 May 2024, 5:57 pm EST - Updated 2 May 2024, 8:18 pm EST

    commented this by mistake look at the comment below

  • Posted 2 May 2024, 5:57 pm EST - Updated 2 May 2024, 6:02 pm EST

  • Posted 5 May 2024, 4:54 pm EST - Updated 5 May 2024, 4:59 pm EST

    Hi,

    As per my understanding, you want the active cell to enter edit mode as soon as starts typing when SpreadJS loads, but it seems this isn’t happening on your end.

    I attempted to reproduce this issue but was unsuccessful. On my end, when I start typing after SpreadJS loads, the active cell enters edit mode as expected. Please refer to the attached gif “autoFocus.gif” and sample.

    GIF:

    Sample: https://jscodemine.mescius.io/share/it52AbL3jkKDXcPbPOu12A/?defaultOpen={"OpenedFileName"%3A["%2Findex.html"%2C"%2Fpackage.json"%2C"%2Fsrc%2Fapp.js"]%2C"ActiveFile"%3A"%2Fsrc%2Fapp.js"}

    To better assist you, could you share a sample along with the steps to replicate the behavior you have observed, or modify the existing sample to replicate the behavior? This will enable me to investigate the problem more thoroughly. And It would be helpful if you could provide a GIF or video illustrating the issue.

    Regards,

    Priyam

  • Posted 5 May 2024, 5:00 pm EST - Updated 5 May 2024, 5:36 pm EST

    can you please tell in the original code of spreadjs what piece of code enables the sheet to enter into edit mode ny default so I can look for the same piece of code in my codebase as to toggle the code and identify why it is preventing it to edit

    or if you have any suggestions as to explicitly enter edit mode through some code.

    like any suggestion as to why i have to click the cell first to edit it and why not directly

  • Posted 6 May 2024, 5:35 pm EST - Updated 6 May 2024, 5:40 pm EST

    Hi,

    You can explicitly focus the SpreadJS by utilizing the “focus” method of SpreadJS, which directs the focus onto the Spread component. Please refer to the attached GIF labeled “focus.gif” and the provided sample for clarification.

    GIF:

    Sample: https://jscodemine.mescius.io/share/--q0dDR7VEqaQQhU6IkSDw/?IsEmbed=false&Theme=Unset&PreviewDirection=0&IsEditorShow=true&IsExplorerShow=true&IsPreviewShow=true&IsConsoleShow=true&IsRunBTNShow=false&IsResetBTNShow=false&IsOpenInCodemineBTNShow=false&PanelWidth=20&PanelWidth=50&PanelWidth=30&defaultOpen={"OpenedFileName"%3A["%2Findex.html"]%2C"ActiveFile"%3A"%2Findex.html"}

    I’m uncertain why this behavior is not the default on your end, as it appears to be the default behavior on my end, as mentioned in a previous comment. Without a sample, it’s difficult to determine what might be causing this deviation in behavior. If the issue persists on your end, could you please provide a sample along with steps to reproduce the observed behavior? Alternatively, modifying the existing sample to replicate the issue would aid in a more thorough investigation.

    References:

    focus: https://developer.mescius.com/spreadjs/api/classes/GC.Spread.Sheets.Workbook#focus

    Regards,

    Priyam

  • Posted 8 May 2024, 4:59 pm EST

    Hi Priyam

    is it possible for me to click the active cell

    by default whenever the sheet opens I have to click the cell first to edit in mu codebase and its a little difficult to debug the issue so as an alternative is there any way that by through code I can click the active cell.

  • Posted 9 May 2024, 5:25 pm EST

    Hi,

    Within SpreadJS, events are internally handled, distinguishing between trusted events, which are generated by user actions, and untrusted events, which are either created or altered by scripts. Only trusted events will trigger the desired actions, while untrusted events will not.

    If the focus method isn’t functioning on your end, you might consider using the startEdit method when SpreadJS initializes. However, be aware that this will place the active cell into edit mode. You can find more information about this method in the following link: https://developer.mescius.com/spreadjs/api/classes/GC.Spread.Sheets.Worksheet#startedit

    If the above suggestions do not resolve the issue on your end, we would need a sample to debug the problem further. Unfortunately, we are unable to replicate the issue on our end. Therefore, it would greatly assist us in providing assistance if you could share a sample along with detailed steps to replicate the observed behavior. This will allow us to investigate the problem more thoroughly.

    Regards,

    Priyam

Need extra support?

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

Learn More

Forum Channels