Topic: [SOLVED] TagbleGrid, Pagination, Footer and Offset
http://myvisualdatabase.com/forum/viewtopic.php?id=4447
NB: MVD 4.6 beta version is required for this to work.
Check it out
procedure Form1_OnShow (Sender: TObject; Action: string);
begin
Form1.cbPages.ItemIndex:=4;////this will show the first 100 records
Form1.GridEmployees.dbLimit := StrToInt((Form1.cbPages.Text));
Form1.bSearch.Click;
end;
procedure Form1_bSearch_OnClick (Sender: TObject; var Cancel: boolean);
begin
Form1.GridEmployees.dbLimit := StrToInt((Form1.cbPages.Text));
Form1.GridEmployees.dbOffSet := 0;
end;
procedure Form1_bNext_OnClick (Sender: TObject; var Cancel: boolean);
begin
Form1.GridEmployees.dbOffSet := Form1.GridEmployees.dbOffSet + StrToInt((Form1.cbPages.Text));
Form1.GridEmployees.dbLimit := StrToInt((Form1.cbPages.Text));
Form1.GridEmployees.dbUpdate;
end;
procedure Form1_bPrev_OnClick (Sender: TObject; var Cancel: boolean);
begin
Form1.GridEmployees.dbOffSet := Form1.GridEmployees.dbOffSet - StrToInt((Form1.cbPages.Text));
Form1.GridEmployees.dbLimit := StrToInt((Form1.cbPages.Text));
if Form1.GridEmployees.dbOffSet < 0 then Form1.GridEmployees.dbOffSet := 0;
Form1.GridEmployees.dbUpdate;
end;
procedure Form1_cbPages_OnChange(Sender: TObject; var Cancel: boolean);
begin
if (Form1.cbPages.ItemIndex =0) then
begin
Form1.cbPages.ItemIndex := 1;
end;
end;
begin
//Form1.GridEmployees.dbLimit := 500;
end.
Download example here
http://myvisualdatabase.com/forum/viewtopic.php?id=4447