You've already forked lazarus-ccr
RxDBGrid: remove old code
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4081 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -49,8 +49,6 @@ type
|
|||||||
|
|
||||||
TFBDataSetSortEngine = class(TRxDBGridSortEngine)
|
TFBDataSetSortEngine = class(TRxDBGridSortEngine)
|
||||||
protected
|
protected
|
||||||
procedure UpdateFooterRows(ADataSet:TDataSet; AGrid:TRxDBGrid);override;
|
|
||||||
function EnabledFooterRowsCalc:boolean;override;
|
|
||||||
public
|
public
|
||||||
procedure Sort(FieldName: string; ADataSet:TDataSet; Asc:boolean; SortOptions:TRxSortEngineOptions);override;
|
procedure Sort(FieldName: string; ADataSet:TDataSet; Asc:boolean; SortOptions:TRxSortEngineOptions);override;
|
||||||
procedure SortList(ListField:string; ADataSet:TDataSet; Asc: array of boolean; SortOptions: TRxSortEngineOptions);override;
|
procedure SortList(ListField:string; ADataSet:TDataSet; Asc: array of boolean; SortOptions: TRxSortEngineOptions);override;
|
||||||
@ -59,34 +57,6 @@ type
|
|||||||
implementation
|
implementation
|
||||||
uses FBCustomDataSet;
|
uses FBCustomDataSet;
|
||||||
|
|
||||||
type
|
|
||||||
THackFBDataSet = class(TFBDataSet);
|
|
||||||
THackRxColumnFooter = class(TRxColumnFooter);
|
|
||||||
|
|
||||||
procedure TFBDataSetSortEngine.UpdateFooterRows(ADataSet: TDataSet;
|
|
||||||
AGrid: TRxDBGrid);
|
|
||||||
var
|
|
||||||
i,j:integer;
|
|
||||||
Col:TRxColumn;
|
|
||||||
begin
|
|
||||||
if not Assigned(ADataSet) then exit;
|
|
||||||
|
|
||||||
for i:=0 to ADataSet.RecordCount-1 do
|
|
||||||
begin
|
|
||||||
for j:=0 to AGrid.Columns.Count-1 do
|
|
||||||
begin
|
|
||||||
Col:=TRxColumn(AGrid.Columns[j]);
|
|
||||||
if THackRxColumnFooter(Col.Footer).ValueType in [fvtSum, fvtAvg, fvtMax, fvtMin] then
|
|
||||||
THackRxColumnFooter(Col.Footer).UpdateTestValueFromVar( THackFBDataSet(ADataSet).GetAnyRecField(i, ADataSet.FieldByName(Col.Footer.FieldName)));
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TFBDataSetSortEngine.EnabledFooterRowsCalc: boolean;
|
|
||||||
begin
|
|
||||||
Result:=true;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TFBDataSetSortEngine.Sort(FieldName: string; ADataSet: TDataSet;
|
procedure TFBDataSetSortEngine.Sort(FieldName: string; ADataSet: TDataSet;
|
||||||
Asc: boolean; SortOptions: TRxSortEngineOptions);
|
Asc: boolean; SortOptions: TRxSortEngineOptions);
|
||||||
begin
|
begin
|
||||||
|
@ -5,7 +5,7 @@ unit exsortzeos;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, DB, RxDBGrid, ZConnection, ZDataset, ZAbstractDataset, ZAbstractRODataset;
|
Classes, SysUtils, DB, RxDBGrid, ZAbstractRODataset;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -13,8 +13,6 @@ type
|
|||||||
|
|
||||||
TZeosDataSetSortEngine = class(TRxDBGridSortEngine)
|
TZeosDataSetSortEngine = class(TRxDBGridSortEngine)
|
||||||
protected
|
protected
|
||||||
procedure UpdateFooterRows(ADataSet:TDataSet; AGrid:TRxDBGrid);override;
|
|
||||||
function EnabledFooterRowsCalc:boolean;override;
|
|
||||||
public
|
public
|
||||||
procedure Sort(FieldName: string; ADataSet:TDataSet; Asc:boolean; SortOptions:TRxSortEngineOptions);override;
|
procedure Sort(FieldName: string; ADataSet:TDataSet; Asc:boolean; SortOptions:TRxSortEngineOptions);override;
|
||||||
procedure SortList(ListField: string; ADataSet: TDataSet; Asc: array of boolean; SortOptions: TRxSortEngineOptions); override;
|
procedure SortList(ListField: string; ADataSet: TDataSet; Asc: array of boolean; SortOptions: TRxSortEngineOptions); override;
|
||||||
@ -23,100 +21,6 @@ type
|
|||||||
implementation
|
implementation
|
||||||
uses ZDbcIntfs, ZVariant;
|
uses ZDbcIntfs, ZVariant;
|
||||||
|
|
||||||
type
|
|
||||||
THackZeosDS = class(TZAbstractRODataset);
|
|
||||||
THackRxColumnFooter = class(TRxColumnFooter);
|
|
||||||
|
|
||||||
THackDataLink = class(TDataLink);
|
|
||||||
THackDataSet = class(TDataSet);
|
|
||||||
THackRxDBGrid = class(TRxDBGrid);
|
|
||||||
|
|
||||||
procedure TZeosDataSetSortEngine.UpdateFooterRows(ADataSet: TDataSet;
|
|
||||||
AGrid: TRxDBGrid);
|
|
||||||
var
|
|
||||||
RS:IZResultSet;
|
|
||||||
CurRow, i:integer;
|
|
||||||
Col:TRxColumn;
|
|
||||||
|
|
||||||
DHL:THackDataLink;
|
|
||||||
DHS:THackDataSet;
|
|
||||||
SaveState:TDataSetState;
|
|
||||||
SavePos:integer;
|
|
||||||
SaveActiveRecord:integer;
|
|
||||||
|
|
||||||
SaveAfterScroll:TDataSetNotifyEvent;
|
|
||||||
SaveBeforeScroll:TDataSetNotifyEvent;
|
|
||||||
begin
|
|
||||||
if not Assigned(ADataSet) then exit;
|
|
||||||
if not Assigned(AGrid) then
|
|
||||||
begin
|
|
||||||
SavePos:=SavePos;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
DHL:=THackDataLink(THackRxDBGrid(AGrid).Datalink);
|
|
||||||
DHS:=THackDataSet(ADataSet);
|
|
||||||
SaveState:=DHS.SetTempState(dsBrowse);
|
|
||||||
|
|
||||||
SaveAfterScroll:=ADataSet.AfterScroll;
|
|
||||||
SaveBeforeScroll:=ADataSet.BeforeScroll;
|
|
||||||
ADataSet.AfterScroll:=nil;
|
|
||||||
ADataSet.BeforeScroll:=nil;
|
|
||||||
|
|
||||||
SaveActiveRecord:=DHL.ActiveRecord;
|
|
||||||
DHL.ActiveRecord:=0;
|
|
||||||
SavePos:=ADataSet.RecNo;
|
|
||||||
|
|
||||||
|
|
||||||
ADataSet.First;
|
|
||||||
while not ADataSet.EOF do
|
|
||||||
begin
|
|
||||||
|
|
||||||
for i:=0 to AGrid.Columns.Count-1 do
|
|
||||||
begin
|
|
||||||
Col:=TRxColumn(AGrid.Columns[i]);
|
|
||||||
if THackRxColumnFooter(Col.Footer).ValueType in [fvtSum, fvtAvg, fvtMax, fvtMin] then
|
|
||||||
// THackRxColumnFooter(Col.Footer).UpdateTestValueFromVar( ADataSet.FieldByName(Col.Footer.FieldName).Value);
|
|
||||||
end;
|
|
||||||
|
|
||||||
ADataSet.Next;
|
|
||||||
end;
|
|
||||||
|
|
||||||
DHS.RecNo := DHL.RecordCount + SavePos + 1;
|
|
||||||
|
|
||||||
while not ADataSet.BOF do
|
|
||||||
begin
|
|
||||||
if SavePos = ADataSet.RecNo then
|
|
||||||
break;
|
|
||||||
ADataSet.Prior;
|
|
||||||
end;
|
|
||||||
|
|
||||||
DHL.ActiveRecord:=SaveActiveRecord;
|
|
||||||
DHS.RestoreState(SaveState);
|
|
||||||
|
|
||||||
ADataSet.AfterScroll := SaveAfterScroll;
|
|
||||||
ADataSet.BeforeScroll := SaveBeforeScroll;
|
|
||||||
{ RS:=THackZeosDS(ADataSet).ResultSet;
|
|
||||||
CurRow:=RS.GetRow;
|
|
||||||
RS.First;
|
|
||||||
// while not RS.IsLast do
|
|
||||||
while not RS.IsAfterLast do
|
|
||||||
begin
|
|
||||||
for i:=0 to AGrid.Columns.Count-1 do
|
|
||||||
begin
|
|
||||||
Col:=TRxColumn(AGrid.Columns[i]);
|
|
||||||
if THackRxColumnFooter(Col.Footer).ValueType in [fvtSum, fvtAvg, fvtMax, fvtMin] then
|
|
||||||
THackRxColumnFooter(Col.Footer).UpdateTestValueFromVar(EncodeVariant(RS.GetValueByName(Col.FieldName)));
|
|
||||||
end;
|
|
||||||
RS.Next;
|
|
||||||
end;
|
|
||||||
RS.MoveAbsolute(CurRow);}
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TZeosDataSetSortEngine.EnabledFooterRowsCalc: boolean;
|
|
||||||
begin
|
|
||||||
Result:=true;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TZeosDataSetSortEngine.Sort(FieldName: string; ADataSet: TDataSet;
|
procedure TZeosDataSetSortEngine.Sort(FieldName: string; ADataSet: TDataSet;
|
||||||
Asc: boolean; SortOptions: TRxSortEngineOptions);
|
Asc: boolean; SortOptions: TRxSortEngineOptions);
|
||||||
begin
|
begin
|
||||||
|
@ -211,8 +211,6 @@ type
|
|||||||
TRxDBGridSortEngine = class
|
TRxDBGridSortEngine = class
|
||||||
protected
|
protected
|
||||||
FGrid:TRxDBGrid;
|
FGrid:TRxDBGrid;
|
||||||
procedure UpdateFooterRows(ADataSet:TDataSet; AGrid:TRxDBGrid);virtual; abstract;
|
|
||||||
function EnabledFooterRowsCalc:boolean;virtual;
|
|
||||||
public
|
public
|
||||||
procedure Sort(FieldName: string; ADataSet: TDataSet; Asc: boolean; SortOptions: TRxSortEngineOptions); virtual; abstract;
|
procedure Sort(FieldName: string; ADataSet: TDataSet; Asc: boolean; SortOptions: TRxSortEngineOptions); virtual; abstract;
|
||||||
procedure SortList(ListField: string; ADataSet: TDataSet; Asc: array of boolean; SortOptions: TRxSortEngineOptions); virtual;
|
procedure SortList(ListField: string; ADataSet: TDataSet; Asc: array of boolean; SortOptions: TRxSortEngineOptions); virtual;
|
||||||
@ -5912,11 +5910,6 @@ end;
|
|||||||
|
|
||||||
{ TExDBGridSortEngine }
|
{ TExDBGridSortEngine }
|
||||||
|
|
||||||
function TRxDBGridSortEngine.EnabledFooterRowsCalc: boolean;
|
|
||||||
begin
|
|
||||||
Result:=false;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TRxDBGridSortEngine.SortList(ListField: string; ADataSet: TDataSet;
|
procedure TRxDBGridSortEngine.SortList(ListField: string; ADataSet: TDataSet;
|
||||||
Asc: array of boolean; SortOptions: TRxSortEngineOptions);
|
Asc: array of boolean; SortOptions: TRxSortEngineOptions);
|
||||||
begin
|
begin
|
||||||
|
@ -44,8 +44,6 @@ type
|
|||||||
|
|
||||||
TRxMemoryDataSortEngine = class(TRxDBGridSortEngine)
|
TRxMemoryDataSortEngine = class(TRxDBGridSortEngine)
|
||||||
protected
|
protected
|
||||||
procedure UpdateFooterRows(ADataSet:TDataSet; AGrid:TRxDBGrid);override;
|
|
||||||
function EnabledFooterRowsCalc:boolean;override;
|
|
||||||
public
|
public
|
||||||
procedure Sort(FieldName: string; ADataSet:TDataSet; Asc:boolean; SortOptions:TRxSortEngineOptions);override;
|
procedure Sort(FieldName: string; ADataSet:TDataSet; Asc:boolean; SortOptions:TRxSortEngineOptions);override;
|
||||||
procedure SortList(ListField:string; ADataSet:TDataSet; Asc: array of boolean; SortOptions: TRxSortEngineOptions);override;
|
procedure SortList(ListField:string; ADataSet:TDataSet; Asc: array of boolean; SortOptions: TRxSortEngineOptions);override;
|
||||||
@ -54,67 +52,6 @@ type
|
|||||||
implementation
|
implementation
|
||||||
uses rxmemds;
|
uses rxmemds;
|
||||||
|
|
||||||
type
|
|
||||||
THackRxColumnFooter = class(TRxColumnFooter);
|
|
||||||
THackDataLink = class(TDataLink);
|
|
||||||
THackDataSet = class(TDataSet);
|
|
||||||
THackRxDBGrid = class(TRxDBGrid);
|
|
||||||
|
|
||||||
procedure TRxMemoryDataSortEngine.UpdateFooterRows(ADataSet: TDataSet;
|
|
||||||
AGrid: TRxDBGrid);
|
|
||||||
var
|
|
||||||
i:integer;
|
|
||||||
Col:TRxColumn;
|
|
||||||
|
|
||||||
DHL:THackDataLink;
|
|
||||||
DHS:THackDataSet;
|
|
||||||
SaveState:TDataSetState;
|
|
||||||
SavePos:integer;
|
|
||||||
SaveActiveRecord:integer;
|
|
||||||
begin
|
|
||||||
if not Assigned(ADataSet) then exit;
|
|
||||||
|
|
||||||
DHL:=THackDataLink(THackRxDBGrid(AGrid).Datalink);
|
|
||||||
DHS:=THackDataSet(ADataSet);
|
|
||||||
SaveState:=DHS.SetTempState(dsBrowse);
|
|
||||||
|
|
||||||
SaveActiveRecord:=DHL.ActiveRecord;
|
|
||||||
DHL.ActiveRecord:=0;
|
|
||||||
SavePos:=ADataSet.RecNo;
|
|
||||||
|
|
||||||
|
|
||||||
ADataSet.First;
|
|
||||||
while not ADataSet.EOF do
|
|
||||||
begin
|
|
||||||
|
|
||||||
for i:=0 to AGrid.Columns.Count-1 do
|
|
||||||
begin
|
|
||||||
Col:=TRxColumn(AGrid.Columns[i]);
|
|
||||||
if THackRxColumnFooter(Col.Footer).ValueType in [fvtSum, fvtAvg, fvtMax, fvtMin] then
|
|
||||||
// THackRxColumnFooter(Col.Footer).UpdateTestValueFromVar( ADataSet.FieldByName(Col.Footer.FieldName).Value);
|
|
||||||
end;
|
|
||||||
|
|
||||||
ADataSet.Next;
|
|
||||||
end;
|
|
||||||
|
|
||||||
DHS.RecNo := DHL.RecordCount + SavePos + 1;
|
|
||||||
|
|
||||||
while not ADataSet.BOF do
|
|
||||||
begin
|
|
||||||
if SavePos = ADataSet.RecNo then
|
|
||||||
break;
|
|
||||||
ADataSet.Prior;
|
|
||||||
end;
|
|
||||||
|
|
||||||
DHL.ActiveRecord:=SaveActiveRecord;
|
|
||||||
DHS.RestoreState(SaveState);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TRxMemoryDataSortEngine.EnabledFooterRowsCalc: boolean;
|
|
||||||
begin
|
|
||||||
Result:=true;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TRxMemoryDataSortEngine.Sort(FieldName: string; ADataSet: TDataSet;
|
procedure TRxMemoryDataSortEngine.Sort(FieldName: string; ADataSet: TDataSet;
|
||||||
Asc: boolean; SortOptions: TRxSortEngineOptions);
|
Asc: boolean; SortOptions: TRxSortEngineOptions);
|
||||||
begin
|
begin
|
||||||
@ -126,7 +63,6 @@ procedure TRxMemoryDataSortEngine.SortList(ListField: string;
|
|||||||
ADataSet: TDataSet; Asc: array of boolean; SortOptions: TRxSortEngineOptions);
|
ADataSet: TDataSet; Asc: array of boolean; SortOptions: TRxSortEngineOptions);
|
||||||
begin
|
begin
|
||||||
if Assigned(ADataSet) then
|
if Assigned(ADataSet) then
|
||||||
// (ADataSet as TRxMemoryData).SortOnFieldsEx(ListField, seoCaseInsensitiveSort in SortOptions, Asc);
|
|
||||||
(ADataSet as TRxMemoryData).SortOnFields(ListField, seoCaseInsensitiveSort in SortOptions, Asc[0]);
|
(ADataSet as TRxMemoryData).SortOnFields(ListField, seoCaseInsensitiveSort in SortOptions, Asc[0]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user