Setting default sort column with sort type in flex sheet

Posted by: bhati.bhati on 4 July 2019, 4:00 am EST

    • Post Options:
    • Link

    Posted 4 July 2019, 4:00 am EST

    Hi Team,

    I am using a flex sheet and I want to set a default sort column (TransID) with sort type as desc on page loading . I am using below code.

    flexSheetInit(flexSheetIntro: wjcGridSheet.FlexSheet) {

    this.flexSheetIntro.selectedSheet.itemsSource = this.data;

    }

    please help.

    Thanks,

    Deepak

  • Posted 5 July 2019, 6:28 am EST

    Hello Deepak,

    You need to use the sortManager property of FlexSheet and add a new sort level to it. Please refer to the code snippet below:

    fSheetInit(fSheet: wjcGridSheet.FlexSheet) {
        fSheet.selectedSheet.itemsSource = this.source;
        fSheet.sortManager.addSortLevel(1, false); // 1 is column index
        fSheet.sortManager.commitSort(false);
      }
    

    You may also refer to the sample below:

    https://stackblitz.com/edit/angular-hvgqx6

    API Reference:

    SortManager: https://www.grapecity.com/wijmo/api/classes/wijmo_grid_sheet.sortmanager.html

    Regards,

    Manish Gupta

  • Posted 5 July 2019, 8:14 am EST

    Thanks Manish , it worked.

Need extra support?

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

Learn More

Forum Channels