1

Topic: Help with GroupBox and sorting

All greetings,  Delphe XE and Devexpress Quantum Grid 6.54, and is easier cxGrid.
There is a label where there is a grouping on an account number. Accordingly also it is sorted by an account number, and it is necessary to me sorting according to date. Found method OnCompare

procedure TForm2.cxGrid1DBBandedTableView1DataControllerCompare (
ADataController: TcxCustomDataController; ARecordIndex1, ARecordIndex2;
AItemIndex: Integer; const V1, V2: Variant; var Compare: Integer);
begin
if ADataController. Values [ARecordIndex1, 2] <ADataController. Values [ARecordIndex2, 2] then
Compare: =-1
else
if ADataController. Values [ARecordIndex1, 2] = ADataController. Values [ARecordIndex2, 2] then
Compare: = 0
else
Compare: = 1;
end;

But then the grouping for some reason glorks - all records sit down in one account. In pictures - before sorting and after.
At me  a component?

2

Re: Help with GroupBox and sorting

Change sort after grouping column CxGrid ?

3

Re: Help with GroupBox and sorting

ma1tus;
I do the same, simply hardly in another way. That code too tried - the same result

4

Re: Help with GroupBox and sorting

aidynchik;
Once again attentively look at the code by the link. Pay attention to parameters V1 and V2.

5

Re: Help with GroupBox and sorting

[spoiler]

var AValue1, AValue2: Variant;
begin
if V1 = V2 then
Compare: = 0
else
begin
AValue1: = ADataController. Values [ARecordIndex1, DateCol. Index];
AValue2: = ADataController. Values [ARecordIndex2, DateCol. Index];
if AValue1 = AValue2 then
Compare: = VarCompare (V1, V2)
else
Compare: = VarCompare (AValue1, AValue2);
end;
end;

[/spoiler]

6

Re: Help with GroupBox and sorting

ma1tus;
I take off before you a hat. All works, thanks!

7

Re: Help with GroupBox and sorting

, not my moped,  in the same place