User (Old forums)MemberApril 27, 2010 at 8:38 amPost count: 23064
I have implemented a custom sorter and monitor the sort direction of the column using Column.SortDirectionChanged to create the illusion of fixed rows. What I need is to keep a certain order in a group while sorting. Say there are three types of values grouped together (value types A,B and C). I need to sort the A separate from the B which are in turn sorted separate from the C. Unfortunately, Compare is only called when the columns sort direction is Ascending (monitored during debug). Is this a know bug in the grid or might I have implemented something wrong? If the thought is this is in my implementation could you please provide a simple example that works properly?
Here is a quick sample to check this behaviour. It is just a VB.Net Windows Forms app with a single label dropped on it. When this is run it confirms what I saw while debugging in a larger application. The label text is only modified after the first click on the column header at which time its text is changed to Ascending. It never changes after this.
Public Class Form1
Private grid As GridControl
Private WithEvents Col1 As Column
Private ColManagerRow As ColumnManagerRow
Private Colmanager1 As ColumnManagerCell
Public mSortDirection As Xceed.Grid.SortDirection
Dim isorter As sorter
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim newrow As DataRow
grid = New GridControl
ColManagerRow = New ColumnManagerRow
Colmanager1 = New ColumnManagerCell(“Col1”)
grid.Size = New Size(Me.ClientSize.Width – 20, Me.ClientSize.Height – 20)
grid.Location = New Point(0, 0)
Col1 = New Column(“Col1”)
Col1.CanBeSorted = True
Col1.Visible = True
Col1.Title = “Col1”
isorter = New sorter(Me)
Col1.DataComparer = isorter
For i As Integer = 1 To 10
newrow = grid.DataRows.AddNew()
newrow.Cells(“Col1”).Value = “Col1Row” & i
Public Class sorter
Public mowner As Form1
Public Sub New(ByVal Owner As Form1)
mowner = Owner
Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare
mowner.Label1.Text = mowner.mSortDirection.ToString
Private Sub Col1_SortDirectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Col1.SortDirectionChanged
mSortDirection = Col1.SortDirection
Imported from legacy forums. Posted by David (had 2702 views)Xceed SupportMemberApril 29, 2010 at 1:43 pmPost count: 5658
The observed behavior is normal: when a new sort is detected and that is the reverse of the previous one, we simply reverse the data order. This was done to get the maximum performance; however, we agree that it is not suitable for your situation.
Unfortunately, we do not have a workaround to provide that would fit exactly your specifications.
Imported from legacy forums. Posted by Mohamed [Xceed] (had 361 views)User (Old forums)MemberApril 30, 2010 at 10:14 amPost count: 23064
That is very bad news. Back to searching for a workable solution then I guess. Thanks anyway.
Imported from legacy forums. Posted by David (had 635 views)User (Old forums)MemberJanuary 27, 2011 at 5:14 amPost count: 23064
Hi, any news. Ive got a similar prob….
Imported from legacy forums. Posted by tm (had 575 views)User (Old forums)MemberJune 24, 2011 at 3:12 pmPost count: 23064
I am looking at this again and hoping there has been a change that would allow this type of implementation. Can this be accomplished using XCeed or should I look elsewhere for a workable solution? Let me rephhrase that. I really like the grid but not being able to keep items grouped as I wished is a deal breaker.
Imported from legacy forums. Posted by David (had 369 views)Xceed SupportMemberJune 29, 2011 at 3:41 pmPost count: 5658
- You must be logged in to reply to this topic.