看来只有动 Diamond的MasterDetailTable
indexFieldName
或再增加一个属性照反序
看 _recordset.sort deascend
请参考 :
procedure TDAOMasterDetailTable.OpenRecordset;
begin
inherited OpenRecordset;
_Recordset := Database._Database.OpenRecordset (FOpenSource, OpenTypeValues [FOpenType], GetOpenParameter (Parameters), LockTypeValues [LockType]);
if Filtered then _Recordset.Filter := Filter;
if FIndexFieldNames <> '' then
begin
FSort := StringReplace (FIndexFieldNames, ';', ',', True);
_Recordset.Sort := FSort;
end;
if Filtered or (FIndexFieldNames <> '') then
_Recordset := _Recordset.OpenRecordset (OpenTypeValues [FOpenType], GetOpenParameter (Parameters));
end;
function StringReplace (const S, OldPattern, NewPattern: string; const IgnoreCase: Boolean): string;
var
SearchStr, Patt, NewStr: string;
Offset: Integer;
begin
if IgnoreCase then
begin
SearchStr := AnsiUpperCase (S);
Patt := AnsiUpperCase (OldPattern);
end
else
begin
SearchStr := S;
Patt := OldPattern;
end;
NewStr := S;
Result := '';
while SearchStr <> '' do
begin
Offset := AnsiPos (Patt, SearchStr);
if Offset = 0 then
begin
Result := Result + NewStr;
break;
end;
Result := Result + Copy (NewStr, 1, Offset - 1) + NewPattern;
NewStr := Copy (NewStr, Offset + Length (OldPattern), MaxInt);
SearchStr := Copy (SearchStr, Offset + Length (Patt), MaxInt);
end;
end;