Jump to content

DBGrid, Extended Events - some events not firing ?


andyhill

Recommended Posts

I have many grids (grdSuppliers etc.) created at runtime and during their creation I set up some ExtEvents (BoxReady, Resize etc.), some work and some do not work.

In the past I have ignored but now tidying up my code - please advise how to get BoxReady and Hide to work - Thanks.

  //////////////////////////////////////////////////////////////////////////////
  grdSuppliers.ClientEvents.ExtEvents.Clear;

  //////////////////////////////////////////////////////////////////////////////
  // BoxReady: NEVER FIRES ?
  MyScript:= 'boxready=function boxready(sender, width, height, eOpts) '+
             '{ '+
             '  ajaxRequest(MainForm.grdSuppliers, ''_BoxReady_'', ["w="+width, "h="+height]); '+
             '} ';
  grdSuppliers.ClientEvents.ExtEvents.Add(MyScript);

  //////////////////////////////////////////////////////////////////////////////
  // Resize: FIRES
  MyScript:= 'resize=function resize(sender, width, height, oldWidth, oldHeight, eOpts) '+
             '{ '+
             '  ajaxRequest(MainForm.grdSuppliers, ''_Resize_'', ["w="+width, "h="+height, "oldw="+oldWidth, "oldh="+oldHeight]); '+
             '} ';
  grdSuppliers.ClientEvents.ExtEvents.Add(MyScript);

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

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

 

Link to comment
Share on other sites

2 minutes ago, andyhill said:

Can you please give me examples on how to add listeners with their appropriate parameters:-

"hide"

"boxready"

Like this for example:

 

Link to comment
Share on other sites

22 minutes ago, andyhill said:

I am after the same parameters as above:-

Yes.

'boxready', 'function(sender, width, height, eOpts) {...'

 

'hide', 'function(sender, eOpts) {...'

 

Link to comment
Share on other sites

grdSuppliers.JSInterface.JSAddListener('boxready', 'function(sender, width, height, eOpts){ajaxRequest(MainForm.grdSuppliers, ''_BoxReady_'', ["w="+width, "h="+height]);}'); // FIRES 🙂

grdSuppliers.JSInterface.JSAddListener('hide', 'function(sender, eOpts){ajaxRequest(MainForm.grdSuppliers, ''_Hiding_'', []);}'); // NEVER FIRES ??? :(
 

Link to comment
Share on other sites


procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  grdSystem.Show;
end;

procedure TMainForm.UniButton2Click(Sender: TObject);
begin
  grdSystem.Hide;
end;

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...