Manuualy change sort direction Arrow graphic
I have an eventhandler which changes the sort behavior to sort by group rather than the individual records as I want the records to ALWAYS sort by a specific field. How can I make this eventhandler change which columnheader the sort direction arrow is on and it's direction. The only way I've found so far is to change/add a SortColumn which changes the sorting of the individual records.
SIGN IN To post a reply.
5 Replies
MP
Markus Persson
November 17, 2008 10:12 AM UTC
I think this is how you do it with a GridControl.
' Turn off the old sort arrow
Me.GridControl1(0, yourColumnThatCurrentlyHasAnAarrow).CellType = "Header"
' Turn on new sort arrow
Me.GridControl1(0, yourColumnThatWillGetAnArrow).CellType = "ColumnHeaderCell"
Me.GridControl1(0, yourColumnThatWillGetAnArrow).Tag = ListSortDirection.Descending/Ascending
AD
Administrator
Syncfusion Team
November 17, 2008 03:57 PM UTC
Thanks, but I need this for a GridGroupingControl.... but this may get me there... if anyone knows exactly how to get to these properties, let me know.
>I think this is how you do it with a GridControl.
>I think this is how you do it with a GridControl.
' Turn off the old sort arrow
Me.GridControl1(0, yourColumnThatCurrentlyHasAnAarrow).CellType = "Header"
' Turn on new sort arrow
Me.GridControl1(0, yourColumnThatWillGetAnArrow).CellType = "ColumnHeaderCell"
Me.GridControl1(0, yourColumnThatWillGetAnArrow).Tag = ListSortDirection.Descending/Ascending
AD
Administrator
Syncfusion Team
November 17, 2008 04:45 PM UTC
Private Sub myGrid_TableControlCellClick(ByVal sender As Object, _
ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventArgs) _
Handles gridSKUList.TableControlCellClick
If TypeOf (myGrid.Table.DisplayElements(e.Inner.RowIndex)) Is GridColumnHeaderRow Then
Dim myGrid As GridGroupingControl = sender
myGrid.TableModel(e.Inner.RowIndex, e.Inner.ColIndex).CellType = "SortColumnHeader"
myGrid.TableModel(e.Inner.RowIndex, e.Inner.ColIndex).Tag = ListSortDirection.Ascending
End If
End Sub
ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventArgs) _
Handles gridSKUList.TableControlCellClick
If TypeOf (myGrid.Table.DisplayElements(e.Inner.RowIndex)) Is GridColumnHeaderRow Then
Dim myGrid As GridGroupingControl = sender
myGrid.TableModel(e.Inner.RowIndex, e.Inner.ColIndex).CellType = "SortColumnHeader"
myGrid.TableModel(e.Inner.RowIndex, e.Inner.ColIndex).Tag = ListSortDirection.Ascending
End If
End Sub
AD
Administrator
Syncfusion Team
November 17, 2008 04:46 PM UTC
Meant to say the above doesn't work. Anyone know why?
NR
Nirmal Raja
Syncfusion Team
November 19, 2008 07:58 PM UTC
Hi,
Thank you for your interest in Syncfusion products.
The QueryCellStyleInfo event can be used to specify the tag of the cell.
The row index and the column index of the header cell can be taken from TableControlCellClick event.
Please refer the code below:
Let me know if you have any queries.
Regards,
Nirmal
Thank you for your interest in Syncfusion products.
The QueryCellStyleInfo event can be used to specify the tag of the cell.
The row index and the column index of the header cell can be taken from TableControlCellClick event.
Please refer the code below:
int rowindex = -1, colindex = -1;
void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.RowIndex == rowindex && e.TableCellIdentity.ColIndex == colindex)
{
e.Style.Tag = ListSortDirection.Ascending;
}
}
void gridGroupingControl1_TableControlCellClick(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.PointToTableCellStyle(new Point(e.Inner.X, e.Inner.Y));
if (this.gridGroupingControl1.Table.DisplayElements[style.TableCellIdentity.RowIndex].Kind == DisplayElementKind.ColumnHeader)
{
rowindex = e.Inner.RowIndex;
colindex = e.Inner.ColIndex;
}
}
Let me know if you have any queries.
Regards,
Nirmal
SIGN IN To post a reply.
- 5 Replies
- 3 Participants
-
AD Administrator
- Nov 16, 2008 04:32 PM UTC
- Nov 19, 2008 07:58 PM UTC