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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Manuualy change sort direction Arrow graphic

Thread ID:

Created:

Updated:

Platform:

Replies:

77756 Nov 16,2008 04:32 PM UTC Nov 19,2008 07:58 PM UTC Windows Forms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On November 16, 2008 04:32 PM UTC

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.


Markus Persson
Replied On 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



Administrator [Syncfusion]
Replied On 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.


' 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





Administrator [Syncfusion]
Replied On 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


Administrator [Syncfusion]
Replied On November 17, 2008 04:46 PM UTC

Meant to say the above doesn't work. Anyone know why?


Nirmal Raja [Syncfusion]
Replied On 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:

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;