We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

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.
Live Chat Icon For mobile
Up arrow icon