FlexSheet - Set default values in rowAdded event

Posted by: holly.anderson on 7 November 2017, 4:43 am EST

    • Post Options:
    • Link

    Posted 7 November 2017, 4:43 am EST

    Hello,

    I’m having a problem with build 5.20172.359. I have a custom handler on the FlexSheet rowAdded event which I use to set default values of new items added via the template row. With build 5.20172.334, I was able to do the following to set the default values and have them appear in the spreadsheet.

    
    sheet.rowAdded.addHandler(function (s, e) {
        e.cancel = true;
        sheet.itemsSource.items.splice(-1, 1, new Widget(sheet.itemsSource.itemCount-1, "", ""));
        setTimeout(function () { sheet.itemsSource.refresh(); }, 0);
    });
    
    

    With the new version, the spreadsheet is not updated to reflect the new values. Please advise if there is some other way that I should be doing this in the new version.

    Thanks,

    Holly

  • Posted 7 November 2017, 4:19 pm EST

    Hi Holly,

    The recommended way to set the default values for new row is to use newItemCreator properties of CollectionView.

    Please refer to the attached sample for the same.

    ~Manish

    FlexSheetDemo_ItemCreator.zip

  • Posted 8 November 2017, 2:45 am EST

    Hi Manish,

    Thanks for the sample. I could’ve sworn I saw an example somewhere that was using the rowAdded event, but I can’t find it now so maybe I’m not remembering correctly. Using newItemCreator makes my code much simpler, so thanks for pointing me in the right direction!

    Holly

Need extra support?

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

Learn More

Forum Channels