New rows are not shown when using databinding with bindcolumns

Posted by: gerald on 22 September 2020, 10:20 pm EST

  • Posted 22 September 2020, 10:20 pm EST

    Hello!
    I don't know if it is by design but if I bind the a sheet to a datasource (a simple array) for the first time, all rows are shown.
    If I now add a record to the datasource array, the sheet does not show this row even after calling spread.refresh() or even setting the datasource again.

    Is this by design? How would I update the sheet to reflect the new row?

    (see attached an example)

    Thank you!

    best regards,
    Geraldrepos.zip
  • Replied 24 September 2020, 2:04 am EST

    Hello Gerald,

    Sorry for the delay. We are working on this. We shall provide you an update soon.

    Regards
    Avinash
  • Marked as Answer

    Replied 27 September 2020, 4:59 pm EST

    Hi Gerald,

    For adding a new row you may use the addRows method. Please refer to the following code snippet and let us know if you face any issues.


    let newItem = new Item();
    newItem.itemId = 500;
    newItem.itemName = "hello, a new one";
    newItem.parentItemId = 500;
    newItem.rowIndentLevel = 2;
    newItem.rowIndex = 2

    this.sheet.addRows(this.sheet.getRowCount(),1)
    this.dataSource.items.splice.apply(this.dataSource.items, [this.sheet.getRowCount()-1, 2,newItem]);
    this.spread.refresh();


    You may also refer to the attached updated sample.

    API References:
    addRows: https://www.grapecity.com/spreadjs/docs/v13/online/SpreadJS~GC.Spread.Sheets.Worksheet~addRows.html
    Regards
    Avinash

    file-dd849b07-5d30-4bbf-9916-c1de27998922.zip
  • Replied 27 September 2020, 6:27 pm EST

    Thank you!
Need extra support?

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

Learn More

Forum Channels