Page 1 of 1

How to use onReady from Power/Data grid

PostPosted: Fri Jun 18, 2021 1:08 am
by pitc
The toolTip for the event is:
Called when the table is ready to be shown

the wiki has:
Event executed when the table is ready to be shown.

I think the ag-grid explanation is this:
When the grid is initialised, it will fire the gridReady event. If you want to use the APIs of the grid, you should put an onGridReady(params) callback onto the grid and grab the api(s) from the params. You can then call these apis at a later stage to interact with the grid (on top of the interaction that can be done by setting and changing the properties).


I do not understand the "ready to be shown" in the Servoy wiki..How should it be used? How do others use it?
The reason I ask is that sometimes there are warnings that the element is not yet in the DOM and perhaps I am attempting to change the grid at the wrong time (mostly to do with restoring columns states from a previously saved variable).

For example should I wait until the onReady event is received and not do any grid api changes at all (sometimes the grid might be in a flex layout which is is "hidden") until then?

Re: How to use onReady from Power/Data grid

PostPosted: Tue Jan 30, 2024 10:36 am
by rieder
+1

Re: How to use onReady from Power/Data grid

PostPosted: Wed Jan 31, 2024 12:44 am
by swingman
Hi Tom,

I add a form variable on my form called grid_ready which I set to false.
When the onReady fires on the grid I set it to true.

Before I call the grid API I check whether grid_ready is true.

This technique gets rid of lots of warnings in the logs.