Not able to get sort icon in Virtual Grid.

Hi I added the code provided in help.

this.gridControl1.CellModels.Add("SortHeader", new GridSortColumnHeaderCellModel(this.gridControl1.Model));

this.gridControl1[0,1].CellType = "SortHeader";

this.gridControl1[0,1].Tag = ListSortDirection.Ascending;

But still i am not able to get sort icon in header columns.

let me know what i am missing

1 Reply

JJ Jisha Joy Syncfusion Team September 28, 2007 03:07 AM UTC

Hi Yeshwant,

Thank you for your interest in Syncfusion Products.

It is possible to get sort icon in header columns by inheriting the GridControl and overriding OnMouseDown event in VirtualGrid.
Here is the code snippets:

//add a sort header to the CellModels.
this.CellModels.Add("ColumnHeaderCell", new GridSortColumnHeaderCellModel(this.Model));
//overriding the OnMouseDown event.
protected override void OnMouseDown(MouseEventArgs e)
{ ................
................
this[0, col].CellType = "ColumnHeaderCell";
if(this[0, col].HasTag)
{
if((ListSortDirection) this[0, col].Tag == ListSortDirection.Ascending)
this[0, col].Tag = ListSortDirection.Descending;
else
this[0, col].Tag = ListSortDirection.Ascending;
}
..................
}

Please refer the following sample that illustrates the same:
http://websamples.syncfusion.com/samples/Grid.Windows/37765/main.htm

Please try this and let me know if you have any questions.

Regards,
Jisha

Loader.
Up arrow icon