The MindFusion Forums
Grid and Spreadsheet Components >> Windows Forms >> Alphabetical Column Ordering User Side
https://mindfusion.eu/Forum/YaBB.pl?num=1517528151

Message started by MindFusionUser47 on Feb 1st, 2018 at 11:35pm

Title: Alphabetical Column Ordering User Side
Post by MindFusionUser47 on Feb 1st, 2018 at 11:35pm
Hi,
How would I go about adding alphabetical column ordering A-Z or Z-A based off a user column click. A click on header column one would reorder column one so that all its rows are in alphabetical order A-Z. A second click would do Z-A. Also I need to keep the rows in order for all columns such that for each row reorder all the rows columns would move. This is so the rows always stay together and data doesn't get mixed up. Make Sense? So is there a built in method? Or will i have to implement it? What are my best options? If you need to know further of what is required let me know.
Thanks,
Jacob

Title: Re: Alphabetical Column Ordering User Side
Post by Meppy on Feb 2nd, 2018 at 8:48am
Hi,

It is possible to sort a range of cells by particular column without mixing up data, that is, the data inside individual rows remains intact when the rows are sorted. However, you currently cannot detect clicks on worksheet headers, so it is not possible to execute the sorting in response to the user clicking on a header.

Here is the code that illustrates how you can sort a range of cells by a specific column:


Code (]var options = new SortOptions();
options.Keys.Add(new SortKey(0));
worksheet.Sort(worksheet.CellRanges["A1:B4"):

, options);

The above code sorts the cells in the range A1:B4 of worksheet worksheet by the first column (column A).

Let me know if this helps.

Regards,
Meppy

The MindFusion Forums » Powered by YaBB 2.6.11!
YaBB Forum Software © 2000-2024. All Rights Reserved.