Sorting the part of grid

Hi!
Is there any way to sort only the part of grid, and not entire grid? That is, if I have grid that looks like:

number | month
--------------
10 | october
7 | july
11 | november
5 | may
9 | september

I want to sort the months starting from third row, leaving october and july rows unsorted.
Sorry for ugly example :)
We use Essential studio 3.3.0.0 and VS.NET 1.1

4 Replies

AD Administrator Syncfusion Team March 13, 2007 09:08 PM UTC

Hi Andrey,

The attached sample implements the ListWrapper class to freeze the rows from sorting in a grid. It also support the multicolumn sorting in a grid. Please try this and let me know if this helps.

[C#]

//set either a Datatable or IList as datasource with FreezeRows
private void SetDataSource(object dataSource)
{
ListWrapper lw = this.gridDataBoundGrid1.DataSource as ListWrapper;
if(lw != null)
lw.UnWireGrid(this.gridDataBoundGrid1);
lw = dataSource is DataTable ? new ListWrapper((DataTable)dataSource) : new ListWrapper((IList)dataSource);
this.gridDataBoundGrid1.DataSource = lw;
lw.WireGrid(gridDataBoundGrid1); // to tie in the UI

//just for timing purposes
lw.SortStarting += new EventHandler(lw_SortStarting);
lw.SortCompleted += new EventHandler(lw_SortCompleted);

//Freeze the rows from Sorting.....
lw.FreezeSortingStartIndex = 0;
lw.FreezeSortingEndIndex = 5;
}

Please refer this.
http://websamples.syncfusion.com/samples/Grid.Windows/FreezeRowsFromSortinggdbg/main.htm

Best regards,
Haneef


AG Andrey Gruber March 14, 2007 05:41 PM UTC

Thanks, Haneef, for reply!
Unfortunately, we use the simple grid, not data bound - I was sure it supports sorting as well, but it does not :(
I'll try something else, may be temporarily storage the data in array with subsequent sorting an replacing the existing one.
Thank you.


AD Administrator Syncfusion Team March 14, 2007 07:21 PM UTC

Hi Andrey,

Here is a modified sample that shows you "How to freeze the rows on sorting in a simple gridcontrol?". Please try the sample and let me know if this helps.
Click here to find GridControlSort sample

Best regards,
Haneef


AG Andrey Gruber March 15, 2007 04:08 PM UTC

Hi, Haneef!
It works! Thank you very much!

Loader.
Up arrow icon