Changing the selected value on a combobox before focussing out of cell

Posted by: brian.couckuyt on 9 February 2022, 7:02 pm EST

  • Posted 9 February 2022, 7:02 pm EST

    Hello,

    In Spread.NET in an ASP.NET MVC 5 application,
    we are trying to fix a problem where, when saving a spreadsheet, if the last edited cell is still focussed, the change is not registered, and does not get saved with it's last given value.

    We have partly fixed this by use of the EditStart and EditStopped events on cells, disabling/enabling the save button, and checking if the callback is finished.

    However, when we use dropdowns (of the ComboBoxCellType), the EditStart/Stopped does not get triggered, resulting in the previous problem persisting (when going from dropdown value 1 to 2, and saving without leaving the cell, the change is not registered).

    In our case, the dropdown box is always required to be shown, so we set the ShowButton property of the ComboBoxCellType to true.

    Is there any solution to this problem you can offer us?

    With regards,
    Brian
  • Marked as Answer

    Replied 13 February 2022, 4:08 pm EST

    Hi Brian,


    For handling changes on Comvboc Cell type you may add an event list of cell editor elements. Please refer to the following code snippet if the issue persists. We request you provide a small working as maple so that we could investigate the issue further and help you accordingly.


    var spread1 = document.getElementById("<%=FpSpread1.ClientID %>");
    //cell 0,0, has a comboBox cell Type
    spread1.getCellFromRowCol(0, 0).querySelector("select").addEventListener("change",
    (e) => { console.log(e.target.options[e.target.selectedIndex].text) });

    Regards,
    Avinash
  • Replied 14 February 2022, 12:09 am EST

    Hello Avinash,

    Thank you for the code sample, with this we were able to fix our issue.


    Kind regards,
    Brian
Need extra support?

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

Learn More

Forum Channels