Topic: form with tablegrid that takes time to load
I've been using a form with a tablegrid to access 32,000 records. The tablegrid is loaded through a button with the search function, native to MVD, and the grid line colors are alternated with the script below, which I got from this forum. I know that if the grid has many columns, it will take a longer time to load the data. Does anyone know if there's a solution for this? MVD is fantastic, but I've run into this problem in a few applications I've built. Would it be the case of having a script that loaded only part of the tablegrid and loaded the rest of the records as the user clicked on pageup or pagedown?
procedure alterna_cor_linha_os;
//*** Proc 741 - alterna cor nas linhas de um grid - procedure serve para qualquer grid
begin
ColorRowGrid(frm_lista_os.TableGrid_OS,clWindow,$00C6E2FF, false);
end;
procedure ColorRowGrid (Grid:TdbStringGridEx;ColorEven,ColorOdd:TColor;ajusta:boolean);
//*** Proc 741 - alterna cor nas linhas de um grid - procedure serve para qualquer grid
var
iRow ,c: integer;
q, iCol: integer;
begin
Grid.BeginUpdate;
c := Grid.RowCount - 1;
q := Grid.Columns.Count-1;
for iRow := 0 to c do
for iCol := 0 to q do
begin
if iRow mod 2 = 0 then Grid.Cell[iCol,iRow].Color := ColorEven
else
Grid.Cell[iCol,iRow].Color := ColorOdd;
end;
if ajusta then Grid.BestFitColumns(bfBoth); //ajusta conteúdo no tablegrid
Grid.EndUpdate;
end;