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.

Problem with sorting

Thread ID:

Created:

Updated:

Platform:

Replies:

67609 Aug 24,2007 11:18 AM Aug 28,2007 05:22 PM Windows Forms 1
loading
Tags: GridControl
Bill Langlais
Asked On August 24, 2007 11:18 AM

I have some code that worked fine in 4.2.0.37 in C++ that when I ported it to C# and 5.1.0.51 it no longer works. Here is the relevant code:


class SortCompareMonths : IComparer
{
public int Compare(int MonthX, int MonthY)
{
if(MonthX < SeasonStartMonth)
{
MonthX += 12;
}

if(MonthY < SeasonStartMonth)
{
MonthY += 12;
}

if(MonthX == MonthY)
{
return(0);
}
else if(MonthX < MonthY)
{
return(-1);
}
else
{
return(1);
}
}
}


Here is where I set up the sorting class defined above:

// Set up a local variable for each tables descriptor
GridTableDescriptor SeasonTotalsTableDescriptor = gridSkiResults.GetTableDescriptor(TrackResults.SeasonTotalsTable);
GridTableDescriptor MonthTotalsTableDescriptor = gridSkiResults.GetTableDescriptor(TrackResults.MonthTotalsTable);
GridTableDescriptor DailyTotalsTableDescriptor = gridSkiResults.GetTableDescriptor(TrackResults.DailyTotalsTable);
GridTableDescriptor SegmentsTableDescriptor = gridSkiResults.GetTableDescriptor(TrackResults.SegmentsTable);
GridTableDescriptor SegmentDataTableDescriptor = gridSkiResults.GetTableDescriptor(TrackResults.SegmentDataTable);

// Change the column header text for the following columns

SeasonTotalsTableDescriptor.GetColumnDescriptor(TrackResults.SkiDayColumn).HeaderText = "Ski Days";
MonthTotalsTableDescriptor.GetColumnDescriptor(TrackResults.SkiDayColumn).HeaderText = "Ski Days";

SeasonTotalsTableDescriptor.GetColumnDescriptor(TrackResults.SkiTimeColumn).HeaderText = "Ski Time";
MonthTotalsTableDescriptor.GetColumnDescriptor(TrackResults.SkiTimeColumn).HeaderText = "Ski Time";
DailyTotalsTableDescriptor.GetColumnDescriptor(TrackResults.SkiTimeColumn).HeaderText = "Ski Time";

SeasonTotalsTableDescriptor.GetColumnDescriptor(TrackResults.LiftTimeColumn).HeaderText = "Lift Time";
MonthTotalsTableDescriptor.GetColumnDescriptor(TrackResults.LiftTimeColumn).HeaderText = "Lift Time";
DailyTotalsTableDescriptor.GetColumnDescriptor(TrackResults.LiftTimeColumn).HeaderText = "Lift Time";

SeasonTotalsTableDescriptor.GetColumnDescriptor(TrackResults.LiftLineTimeColumn).HeaderText = "Lift Line Time";
MonthTotalsTableDescriptor.GetColumnDescriptor(TrackResults.LiftLineTimeColumn).HeaderText = "Lift Line Time";
DailyTotalsTableDescriptor.GetColumnDescriptor(TrackResults.LiftLineTimeColumn).HeaderText = "Lift Line Time";

SeasonTotalsTableDescriptor.GetColumnDescriptor(TrackResults.RestTimeColumn).HeaderText = "Rest Time";
MonthTotalsTableDescriptor.GetColumnDescriptor(TrackResults.RestTimeColumn).HeaderText = "Rest Time";
DailyTotalsTableDescriptor.GetColumnDescriptor(TrackResults.RestTimeColumn).HeaderText = "Rest Time";


SeasonTotalsTableDescriptor.GetColumnDescriptor(TrackResults.TotalTimeColumn).HeaderText = "Total Time";
MonthTotalsTableDescriptor.GetColumnDescriptor(TrackResults.TotalTimeColumn).HeaderText = "Total Time";
DailyTotalsTableDescriptor.GetColumnDescriptor(TrackResults.TotalTimeColumn).HeaderText = "Total Time";

DailyTotalsTableDescriptor.GetColumnDescriptor(TrackResults.DateTimeColumn).HeaderText = "DateTime";

SegmentsTableDescriptor.GetColumnDescriptor(TrackResults.AverageSpeedColumn).HeaderText = "Average Speed";

SegmentsTableDescriptor.GetColumnDescriptor(TrackResults.SegmentColumn).HeaderText = "#";
SegmentDataTableDescriptor.GetColumnDescriptor(TrackResults.SegmentColumn).HeaderText = "#";

SetGridDistanceHeaders();

for(int Inc = 0 ; Inc < TrkResults.Results.Tables.Count ; ++Inc) {
gridSkiResults.GetTableControl(TrkResults.Results.Tables[Inc].TableName).MouseUp += new System.Windows.Forms.MouseEventHandler(GridSkiResultsTableMouseUp);
}

OptimizeSkiResultsGrid(gridSkiResults);

gridSkiResults.Engine.NestedTableGroupOptions.ShowAddNewRecordAfterDetails = false;
gridSkiResults.Engine.NestedTableGroupOptions.ShowAddNewRecordBeforeDetails = false;

gridSkiResults.Engine.TopLevelGroupOptions.ShowAddNewRecordAfterDetails = false;
gridSkiResults.Engine.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false;


SetColumnStyleDelegate ConfigColumnsDelegate = new SetColumnStyleDelegate(ConfigColumn);
UpdateProperties(ConfigColumnsDelegate);

// Set up custom sorting on months also ensures sort when adding records.
SortColumnDescriptor SCD = new SortColumnDescriptor(TrackResults.MonthColumn);
SCD.Comparer = new SortCompareMonths() as System.Collections.IComparer;
MonthTotalsTableDescriptor.SortedColumns.Add(SCD);


I put a breakpoint in the sorting method but it never gets called.

Any idea why this does not work?

haneefm [Syncfusion]
Replied On August 28, 2007 05:22 PM

Hi Bill,

Your incident(#36885) has been updated. Please follow the incident for more details.

Best regards,
Haneef

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.

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.

;