unit View.{ENTITY}.List;

interface

uses
  System.SysUtils, System.Classes, WEBLib.Graphics, WEBLib.Forms, WEBLib.Dialogs,
  Vcl.Controls, Vcl.StdCtrls, Math,

  WEBLib.StdCtrls, Web, JS, WEBLib.Lists,

  App.Types, WEBLib.Controls, WEBLib.Grids, Data.DB,
  XData.Web.Dataset, WEBLib.DBCtrls, WEBLib.DB, WEBLib.ExtCtrls,

  XData.Web.JsonDataset,
  XData.Web.Dataset,

  Grid.Plugins,
  Crud.Utils;

type
  TFView{ENTITY}List = class(TWebForm)
{BUTTONNEWFIELD}{DATASETFIELDS}    WebDBTableControl1: TWebDBTableControl;
    WebDataSource: TWebDataSource;
    cbPageSize: TWebComboBox;
    edSearch: TWebEdit;
    lbPaginationInfo: TWebLabel;
    lcPaginator: TWebListControl;
    procedure WebFormCreate(Sender: TObject);
{BUTTONNEWCLICKEVENTDECLARATION}{GETCELLCHILDRENMETHODDECLARATION}    procedure cbPageSizeChange(Sender: TObject);
    procedure edSearchChange(Sender: TObject);
  private
{EDITPROCFIELD}    FGridPlugin: TGridPlugin;
  public
{CREATEFORMMETHODDECLARATION}  end;

var
  FView{ENTITY}List: TFView{ENTITY}List;

implementation

uses
  ConnectionModule;

{$R *.dfm}

{ TFView{ENTITY}List }

procedure TFView{ENTITY}List.cbPageSizeChange(Sender: TObject);
begin
  FGridPlugin.SetPageSize(StrToInt(cbPageSize.Text), True);
end;

{CREATEFORMMETHODIMPLEMENTATION}procedure TFView{ENTITY}List.edSearchChange(Sender: TObject);
begin
  FGridPlugin.SetFilterText(edSearch.Text, True);
end;

{BUTTONNEWCLICKEVENTIMPLEMENTATION}{GETCELLCHILDRENMETHODIMPLEMENTATION}procedure TFView{ENTITY}List.WebFormCreate(Sender: TObject);
begin
  FGridPlugin := TGridPlugin.Create(
    WebDBTableControl1,
    {ENTITY}Dataset,
    lcPaginator,
    lbPaginationInfo
  );
  FGridPlugin.SetPageSize(StrToInt(cbPageSize.Text));
  FGridPlugin.SetFilterText(edSearch.Text);
  FGridPlugin.Load;
end;

end.
