Autosize FlexSheet

Posted by: holly.anderson on 10 October 2017, 12:41 am EST

    • Post Options:
    • Link

    Posted 10 October 2017, 12:41 am EST

    Hello,

    I’ve been told that if a FlexSheet is bound with Knockout, the height on the control must be explicitly set, otherwise no data will appear in the spreadsheet. Instead of explicitly setting the height, I’d like the height of the spreadsheet to automatically adjust based on the number of rows (with some max-height) so that there is no empty space underneath. In my scenario, the spreadsheet may start with just one row, but the user can add and delete rows. What would be the best way to achieve this?

    Thanks,

    Holly

  • Posted 10 October 2017, 3:39 pm EST

    Hi Holly,

    You can set height of FlexSheet using hostElement based on cumulative rows height. You can set height after FlexSheet initialized and collectionChanged for updating height of FlexSheet on adding rows.

    For your reference, please refer to the attached sample for the same.

    Thanks,

    Manish Kr Gupta

    FlexSheet_AutoSizeHeight.zip

  • Posted 16 October 2017, 12:01 am EST

    Hi Manish,

    I just noticed that this solution doesn’t work properly when filters are applied. Any suggestions on what can be done in that case?

    Thanks,

    Holly

  • Posted 16 October 2017, 6:17 pm EST

    Hi Holly,

    You will need to use the FilterChangedEvent to re-calculate the height, however this is going to be costly to do this after each Filter change.

    http://demos.wijmo.com/5/Angular/WijmoHelp/WijmoHelp/topic/wijmo.grid.filter.FlexGridFilter.Class.html

    http://demos.wijmo.com/5/Angular/WijmoHelp/WijmoHelp/topic/wijmo.grid.sheet.filter.FlexSheetFilter.Class.html

    Thanks,

    Abhishek

Need extra support?

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

Learn More

Forum Channels