Get updated cell value on cell text change

Posted by: tushar.thakur on 18 November 2019, 12:10 pm EST

  • Posted 18 November 2019, 12:10 pm EST

    Hi,

    I am from Pearson team and we had raised following query previously

    https://www.grapecity.com/forums/spread-winforms/default-alignment-of-cell-

    We are currently using SpreadJS version 12.2.5

    Now my question is as described below.

    I have a keyDown event on the spreadsheet cell.

    Is there a way that after each keydown I can get cell’s text?

    Currently I can get cell text using following code, but that updates only when we change the cell focus.

    var cell = this.sheet.getCell(this.sheet.getActiveRowIndex(), this.sheet.getActiveColumnIndex());
    cell.text()
    

    Now is there a way so that we can get an event on text change or we can call some function so that cell text is saved and we can retrieve it on text change?

    Thanks,

    Tushar

  • Posted 19 November 2019, 3:38 am EST

    for example.

    1. If cell 0,0 has a text “Sample”

    2. double click that cell to start editing

    3. we press backspace 2 times.

    4. in keyDown/keyUp event we try to get cell text by cell.text()/cell.getValue()

    Expected output is “Samp”, but I am getting “Sample”.

  • Posted 19 November 2019, 4:43 am EST

    Hi Tushar,

    You could handle the EditChange event to detect changes in the text when cell is in edit mode. Please refer to the following code snippet:

    spread.bind(GC.Spread.Sheets.Events.EditChange, function(e, args) {
        console.log(args.editingText);
      });
    

    API Reference:

    • EditChange event: http://help.grapecity.com/spread/SpreadSheets12/webframe.html#SpreadJS~GC.Spread.Sheets.Events~EditChange_EV.html

    Regards

    Sharad

Need extra support?

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

Learn More

Forum Channels