How to get multiple sort info from grid

Posted by: bharath-ron on 8 September 2017, 2:23 pm EST

  • Posted 8 September 2017, 2:23 pm EST

    Hello All,


     I was assigning the sort info for the multiple columns in the grid. I wanted to get the multicolumns sort info back from the grid instance.


    How would i get the information back from the grid. Any suggestion regarding this would be helpful.


    To assign the sortinfo to multiple column in writing the following code:-


    SortInfo[ ] sortInfoArray = new SortInfo[ 3 ];
    grid.sheetView.SortRows ( 0 , grid.sheetView.RowCount , sortInfoArray ); 


    Note : - i am trying to fetch in which order the columns is being sorted. i.e., in which first column that is sorted , which is second ..... so on and so forth.


     


    Thanks in Advance.


    Bharath Ron

  • Replied 8 September 2017, 2:23 pm EST

    Hello Bharath,


    Here is the code to achieve the desired behavior:



            SortInfo[] si;
            private void MultiColumnSort_Click(object sender, EventArgs e)
            {
                SortInfo sorter1 = new SortInfo(4, true);
                SortInfo sorter2 = new SortInfo(5, true);
                si = new SortInfo[] { sorter1, sorter2 };
                fpSpread1.Sheets[0].SortRows(0, fpSpread1.Sheets[0].RowCount, si);
            }
            private void GetSortOrder_Click(object sender, EventArgs e)
            {
                for (int i = 0; i < si.Length; i++)
                    listBox1.Items.Add(siIdea.Index);
            }


    Hope this will help you. Thanks.

Need extra support?

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

Learn More

Forum Channels