Custom column headers applied on dataSource are not reactive on add/remove cols

Posted by: davide.vago on 31 August 2019, 12:39 am EST

  • Posted 31 August 2019, 12:39 am EST

    Good morning/afternoon

    Following up this post: https://www.grapecity.com/forums/spread-sheets/how-to-disable-the-column-#hi-davideyou-may-use-the-s

    The code generates the letter references for every column, however if the user does edit the columns the column names aren't updating accordingly.

    E.g.

    The user creates a new column between column C and D, the new generated column has name C but the next column keeps the letter C (this applies even for delete event)



  • Marked as Answer

    Replied 1 September 2019, 7:55 pm EST

    Hi Davide,

    In this case, you may handle the ColumnChanged event and update the headers when required. Please refer to the following code snippet and the sample which demonstrates the same:

    sheet.bind(GC.Spread.Sheets.Events.ColumnChanged, function(e, args) {
    if (
    args.propertyName === "addColumns" ||
    args.propertyName === "deleteColumns"
    ) {
    setHeaderNames(sheet);
    }
    });

    https://codesandbox.io/s/spread-js-starter-i58qr

    Regards
  • Replied 2 September 2019, 1:15 am EST

    Thanks, this works
Need extra support?

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

Learn More

Forum Channels