Topic: [Скрипт] Постраничный вывод записей в TableGrid

Постраничный вывод записей в TableGrid


Проект с примером.
http://myvisualdatabase.com/forum/misc. … download=1


http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=6587&download=0



CONST
    RECORS_LIMIT = 500;

procedure Form1_OnShow (Sender: TObject; Action: string);
begin
    Form1.bSearch.Click;
end;

procedure Form1_bSearch_OnClick (Sender: TObject; var Cancel: boolean);
begin
    Form1.GridEmployees.dbOffSet := 0;
end;

procedure Form1_bNext_OnClick (Sender: TObject; var Cancel: boolean);
begin
    if Form1.GridEmployees.RowCount = 0 then exit;
    Form1.GridEmployees.dbOffSet := Form1.GridEmployees.dbOffSet + RECORS_LIMIT;
    Form1.GridEmployees.dbUpdate;
end;

procedure Form1_bPrev_OnClick (Sender: TObject; var Cancel: boolean);
begin
    Form1.GridEmployees.dbOffSet := Form1.GridEmployees.dbOffSet - RECORS_LIMIT;
    if Form1.GridEmployees.dbOffSet < 0 then Form1.GridEmployees.dbOffSet := 0;
    Form1.GridEmployees.dbUpdate;
end;

begin
    Form1.GridEmployees.dbLimit := RECORS_LIMIT;
end.
Post's attachments

Attachment icon offset.jpg 88.84 kb, 18 downloads since 2020-05-14 

Attachment icon TableGrid pagination.zip 345.21 kb, 103 downloads since 2020-05-14 

Dmitry.