Hi, i've a bug on TAdvColumnGrid
Code :
ColumnGrid.BeginUpdate;
try
ColumnGrid.ColumnSize.Stretch := true;
ColumnGrid.RowCount := length(ListeFacture)+2;
for i := 0 to high(ListeFacture) do
begin
AfficherLigneFacture(ListeFacture,false,i+1); // Load a row
end;
ColumnGrid.QSort;
finally
TableauFacture.EndUpdate;
end;
Process :
Load a grid with multiple row,
sort on a column
Select a row (ex row 10)
reload grid with less than 10 lines
Bug on QSort
i've try :
UnSelectRow(0,ColumnGrid.RowCount-1) before load => not working
this work but i loose Sort :
if ColumnGrid.SortSettings.Column <> -1 then // why we must protect like this ?
begin
ColumnGrid.QUnSort;
ColumnGrid.SortSettings.Column := -1;
end;
This was simulated with a default TAdvColumnGrid and the code:
procedure TForm5.Button1Click(Sender: TObject);
begin
advcolumngrid1.BeginUpdate;
try
advcolumngrid1.RowCount := 10;
advcolumngrid1.RandomFill(false);
advcolumngrid1.SortSettings.Column := 1;
advcolumngrid1.QSort;
finally
advcolumngrid1.EndUpdate;
end;
advcolumngrid1.Row := advcolumngrid1.RowCount - 1;
end;
procedure TForm5.Button2Click(Sender: TObject);
begin
advcolumngrid1.BeginUpdate;
try
advcolumngrid1.RowCount := 8;
advcolumngrid1.RandomFill(false);
advcolumngrid1.SortSettings.Column := 1;
advcolumngrid1.QSort;
finally
advcolumngrid1.EndUpdate;
end;
end;
and pressing button1 followed by button2 but no problem can be reproduced here.
sorry i'haven't tried on a base columnGrid :
i've got the error with a base columnGrid with this options
FixedFooters := 1;
FloatingFooters.visible := true;
and this change on code :
procedure TForm5.Button1Click(Sender: TObject);
begin
advcolumngrid1.BeginUpdate;
try
advcolumngrid1.RowCount := 30;
advcolumngrid1.RandomFill(false);
advcolumngrid1.SortSettings.Column := 1;
advcolumngrid1.QSort;
finally
advcolumngrid1.EndUpdate;
end;
advcolumngrid1.Row := advcolumngrid1.RowCount - 1 - advcolumngrid1.FixedFooters;
end;
procedure TForm5.Button2Click(Sender: TObject);
begin
advcolumngrid1.BeginUpdate;
try
advcolumngrid1.RowCount := 8;
advcolumngrid1.RandomFill(false);
advcolumngrid1.SortSettings.Column := 1;
advcolumngrid1.QSort;
finally
advcolumngrid1.EndUpdate;
end;
end;
We have applied a fix to avoid this issue. Fix will be included in the next update.
Thanks, nice reactivity :D