andyhill Posted May 6 Share Posted May 6 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); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 6 Share Posted May 6 Hello @andyhill We will check. But, try also adding an event via grdSuppliers.JSInterface.JSAddListener() and check if it works. Quote Link to comment Share on other sites More sharing options...
andyhill Posted May 6 Author Share Posted May 6 Can you please give me examples on how to add listeners with their appropriate parameters:- "hide" "boxready" Thanks Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 6 Share Posted May 6 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: Quote Link to comment Share on other sites More sharing options...
andyhill Posted May 6 Author Share Posted May 6 I am after the same parameters as above:- "boxready" sender, width, height, eOpts "hide" sender, eOpts Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 6 Share Posted May 6 22 minutes ago, andyhill said: I am after the same parameters as above:- Yes. 'boxready', 'function(sender, width, height, eOpts) {...' 'hide', 'function(sender, eOpts) {...' Quote Link to comment Share on other sites More sharing options...
andyhill Posted May 6 Author Share Posted May 6 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 ??? Quote Link to comment Share on other sites More sharing options...
andyhill Posted May 7 Author Share Posted May 7 Can you please advise why "hide" FAILS to FIRE Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 7 Share Posted May 7 1 minute ago, andyhill said: Can you please advise why "hide" FAILS to FIRE How are you hiding the grid? Quote Link to comment Share on other sites More sharing options...
andyhill Posted May 8 Author Share Posted May 8 yes Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 8 Share Posted May 8 40 minutes ago, andyhill said: yes How? Quote Link to comment Share on other sites More sharing options...
andyhill Posted May 8 Author Share Posted May 8 procedure TMainForm.UniButton1Click(Sender: TObject); begin grdSystem.Show; end; procedure TMainForm.UniButton2Click(Sender: TObject); begin grdSystem.Hide; end; Quote Link to comment Share on other sites More sharing options...
andyhill Posted May 8 Author Share Posted May 8 Sent privately Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 8 Share Posted May 8 Ok. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.