SortComparer in SfTreeGrid


When sorting using the custom comparer SfTreeGrid does not use the ISortDirection interface.


Regards,
Andrej

3 Replies

JG Jai Ganesh S Syncfusion Team November 24, 2017 07:30 AM UTC

Hi Andrej, 
 
In SfTreeGrid, we have implemented the ISortDirection interface for custom sorting. We already have a UG and dashboard sample for this and you can refer the links from below, 
 
 
 
Could you please compare the code for the above sample with your application and please make a correction if you did anything missing in your application. If you still facing the issue then please replicate the issue in the above sample or if possible please share your application to check the issue.  
 
Regards, 
Jai Ganesh S 



AR Andrej Repin November 24, 2017 07:45 AM UTC

Hi,

From your example. File CustomComparer.cs

    public class CustomComparer : IComparer<object>, ISortDirection
    {
        //Get or Set the SortDirection value
        private ListSortDirection _SortDirection;
        public ListSortDirection SortDirection
        {
            get { return _SortDirection; }
            set
            {
                _SortDirection = value; 
            }
        }

The breakpoint on the selected line is never hit and _SortDirection is always 0.


Regards,
Andrej




JG Jai Ganesh S Syncfusion Team November 29, 2017 08:59 AM UTC

 
In our sample we have implemented the ISortDirection interface but it never executes for initial loading. The ISortDirection interface is used to update the SortDirection while we are adding the records at runtime. We have modified the sample based on this and you can refer the sample from the below location, 
 
 
Video Link: 
 
In the above video illustrates, the SortDirection will be updated while adding a record at run time. 
 
Regards, 
Jai Ganesh S

Loader.
Up arrow icon