dxMemData1.SortedField := Lindex; dxMemData1.SortOptions := []; var i: Integer; begin // dxDBGrid_ColumnClick(TdxDBGrid(Sender), Column); dxMemData2.DisableControls; for i := 0 to dxDBGrid1.ColumnCount - 1 do dxDBGrid1.columns[i].Sorted := csnone; dxMemData2.SortedField := Column.FieldName; if a_sortDbGrid = 1 then begin dxMemData2.SortOptions := []; Column.Sorted := csdown; a_sortDbGrid := 2; end else begin dxMemData2.SortOptions := [soDesc]; Column.Sorted := csUp; a_sortDbGrid := 1; end; dxMemData2.First; dxMemData2.EnableControls; end;