FlexGrid Column Visibility

Posted by: paulr on 10 March 2021, 5:17 pm EST

    • Post Options:
    • Link

    Posted 10 March 2021, 5:17 pm EST - Updated 3 October 2022, 2:17 pm EST

    Hi,

    I am using FlexGrid with ODataCollectionView in React.

    When the grid is loaded with data for the first time, the columns which have no values (empty/null) are not shown on the grid. That’s fine because I didn’t define the column layout explicitly. However when I sort the data which makes another fetch to the server for a different set of data, then the columns which are displayed are not changed - so I see columns with empty data like this:

    Is there a method I can call to refresh the table columns and hide the empty ones?

    Thanks,

    Paul

  • Posted 11 March 2021, 3:27 am EST

    Hi Paul,

    To achieve the required functionality you may handle the sourceCollectionChanged event and clear the columns inside the handler which will result in regeneration of the columns. Please refer to the following code snippet and let us know if you face any issues:

    grid.collectionView.sourceCollectionChanging.addHandler((s, e) => {

    grid.columns.clear();

    });

    Regards

    Sharad

Need extra support?

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

Learn More

Forum Channels