SourceGrid multi level sort in different column

Dec 19, 2011 at 10:23 AM

Hi All,

I am currently working on sourcegrid and I need an urgent help in solving a problem i am facing.

I have a sourcegrid with 2 main columns name 'Company Name' and 'Services'.

Example:

Company Name |  Services

cc                     |   ceiling

ss                    |    bituminous plants

ee                    |    acoustic floor

aa                    |    acoustic floor

 

Now, When i click on Services column header, The services column is sorted. and the result is shown below:

Company Name |  Services

ee                     |   acoustic floor

aa                    |    acoustic floor

ss                    |    bituminous plants

cc                    |    ceiling

 

If you notice acoustic floor is provided by 2 companies namely 'ee' and 'aa'. Is there a way by which there is a second level of sort is

done and the Company names which provide the first service are also sorted automatically so that when i click on

Services column header i get the results as:

Company Name |  Services

aa                     |   acoustic floor

ee                    |    acoustic floor

ss                    |    bituminous plants

cc                    |    ceiling

 

In this results the companies which provide acoustic floor services are also sorted. 

 

I need immediate help. So please, any information will be highly appreciated.

 

Thanks.

Dec 21, 2011 at 6:33 AM

Have you looked at the MultiColumnsComparer class already?

You can specifiy how your column is sorted like this:
(grid[ ... ] as HeaderCell).SortComparer = new MultiColumnsComparer( ... );

Dec 21, 2011 at 6:38 AM

Thanks for your Reply. Can you explain in detail coz its the first time i am working on sourcegrid. Thanks>

Dec 21, 2011 at 10:05 AM

Look at sample form 47 in the SourceGrid project:

SourceGrid.Examples\GridSamples\AdvancedFeatures\frmSample47.cs

method "frmSample47_Load"

Dec 21, 2011 at 11:17 AM

 My problem is solved. Works like Magic........Thanks a million for your help :)