1

Delphi 10.4.2, TTMSFNCGrid ver. 1.0.5.16

I am downloading about 30,000 records from the database into a json object. This takes about 1 minute.

I then try to enter (for a loop) the data into TTMSFNCGrid which has about 30,000 records and 16 columns. The data entry takes 20 minutes ! This is how long it takes to render and populate the grid. How can I speed up this process?

I use something like this

 for _i:= 0 to JSON_ARRAY_DANE.Count-1 do
 begin
     _row:=  JSON_ARRAY_DANE.Items[_i] as TJSONObject;
     _grid.Cells[0,_i+1]:=_row.GetValue('c1').Value;
     _grid.Cells[1,_i+1]:=_row.GetValue('c2').Value;
     _grid.Cells[2,_i+1]:=_row.GetValue('c3').Value;
     .
     .
     _grid.Cells[2,_i+1]:=_row.GetValue('c16').Value;
end
Olaf
  • 215
  • 2
  • 14
  • Your q needs a [minimal, reproducible example](https://stackoverflow.com/help/mcve) but in any case what do TMS say? – MartynA Jul 06 '21 at 18:52
  • TMS is not saying anything yet. I have only just written to them. But maybe someone here has had a similar problem – Olaf Jul 06 '21 at 18:59

1 Answers1

1

Resolved. Need to add:

_grid.BeginUpdate; _grid.EndUpdate;

 **_grid.BeginUpdate;**
 for _i:= 0 to JSON_ARRAY_DANE.Count-1 do
 begin
     _row:=  JSON_ARRAY_DANE.Items[_i] as TJSONObject;
     _grid.Cells[0,_i+1]:=_row.GetValue('c1').Value;
     _grid.Cells[1,_i+1]:=_row.GetValue('c2').Value;
     _grid.Cells[2,_i+1]:=_row.GetValue('c3').Value;
     .
     .
     _grid.Cells[16,_i+1]:=_row.GetValue('c16').Value;
end;
 **_grid.EndUpdate;**
Olaf
  • 215
  • 2
  • 14