Jump to content

DBGrid AjaxEvent: Adding Hide/Show Events


andyhill

Recommended Posts

procedure TMainForm.UniFormCreate(Sender: TObject);

...
  
  //////////////////////////////////////////////////////////////////////////////
  grdSuppliers.ClientEvents.ExtEvents.Clear;
  MyScript:= 'hide=function hide(sender, eOpts)'#10+
             '{ '#10+
             '  ajaxRequest(MainForm.grdSuppliers, ''_Hiding_'', []); '+
             '} ';
  grdSuppliers.ClientEvents.ExtEvents.Add(MyScript);
  //
  MyScript:= 'show=function show(sender, eOpts)'#10+
             '{ '#10+
             '  ajaxRequest(MainForm.grdSuppliers, ''_Showing_'', []); '+
             '} ';
  grdSuppliers.ClientEvents.ExtEvents.Add(MyScript);

...

 

// ONLY EVENTS FIRED data/load/columnresize
procedure grdSuppliersAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings);

...

  //////////////////////////////////////////////////////////////////////////////
  if SameText('_Hiding_', EventName) then begin // NEVER FIRES 
 

  //////////////////////////////////////////////////////////////////////////////
  if SameText('_Showing_', EventName) then begin // NEVER FIRES
 

Please advise - Thanks in advance

Link to comment
Share on other sites

Can we please make Grid Hide/Show events work.

MyScript:= 'show=function show(sender, eOpts)'#10+
           '{ '#10+
           '  ajaxRequest(MainForm.grdSuppliers, ''_Showing_'', []); '+
           '} ';
grdSuppliers.ClientEvents.ExtEvents.Add(MyScript);

Link to comment
Share on other sites

On 12/31/2023 at 12:09 PM, Sherzod said:

show, hide, for what?

 

8 hours ago, andyhill said:

Can we please make Grid Hide/Show events work.

Now I understand that it was for the grid.

Do you show/hide during runtime?

Link to comment
Share on other sites

Sherzod, on Grids created at runtime (in FormCreate) my runtime assigned events do not fire ?

If Grids are added to the Form in the IDE and Events are set in the ClientEvents Editor they do fire.

FormCreate
grdSuppliers:= TUniDBGrid.Create(pnlInfo); (pnlInfo is a child of MainForm)

// Show
grdSuppliers.ClientEvents.ExtEvents.Clear;
MyScript:= 'show=function show(sender, eOpts)'#10+
             '{ '#10+
             '  ajaxRequest(MainForm.grdSuppliers, ''_Showing_'', []); '+ (tried different ways - NEVER FIRES)
             '  ajaxRequest(MainForm.pnlInfo.grdSuppliers, ''_Showing_'', []); '+ (tried different ways - NEVER FIRES)
             '  ajaxRequest(MainForm.window, ''_Showing_'', []); '+ (tried different ways - NEVER FIRES)
             '  ajaxRequest(MainForm, ''_Showing_'', []); '+ (tried different ways - NEVER FIRES)
             '} ';
grdSuppliers.ClientEvents.ExtEvents.Add(MyScript);

Please show me how to add 'Show' Event at runtime to a Grid created at runtime whose parent is pnlInfo - Thanks

Link to comment
Share on other sites

Yes Sherzod - that was embarrassing - thank you.

FYI 'show' works fine but 'hide' does not and that goes for IDE/EventEditor versions and RUNTIME/Create versions - 'show' works fine in both cases but 'hide' does not work in either.

Any ideas ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...