ag-grid/ag-grid-enterprise

"beforeReady" prop

edgarsi opened this issue · 1 comments

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/ceolter/ag-grid-enterprise/blob/master/CONTRIBUTING.md#question

Current behavior
One of the most useful patterns of the grid API is to save and restore state on page reload. This can be done by calling applyColumnState, getFilterModel etc when the grid becomes ready. However, until the state changes get applied, the grid is shown with the default state, unavoidably.

This can be bypassed by modifying props, e.g. filling columnDefs with initial* values, but that's more complex than it should be. Some state, such as filter model, can't even be done this way.

Alternatively, one can attempt to hide the table and wait on events such as columnEverythingChanged and filterChanged, also complex because these events can be caused in several ways and don't carry information of who caused them.

Expected behavior
The simplest solution from the perspective of keeping the API simple would be a beforeReady prop which would ensure the API can be used before the grid is marked ready:

<AgGridReact
  beforeReady={(params) => doInitialWork(params.api)}

AG Grid would have to track when the calls to applyColumnState etc have finished their work, and only then mark the grid as ready. The grid would have to be hidden (i.e. loading) before marked ready.

What is the motivation / use case for changing the behavior?
Simplify using the API.

Hello @edgarsi!

Thank you for bringing this up with us.

We have added a feature request in our backlog to track this requirement and implement it in the future.

You can track it with this reference:
AG-1535 [State] Allow providing object that contains initial state for the grid

You can follow the status of feature requests, bugs and releases using our pipeline:
https://www.ag-grid.com/ag-grid-pipeline/

Now that this requirement is recorded in our backlog, we will soon close the GitHub issue because we will not update it when this feature is added in a future version of AG Grid. The best way to get an update on this item is to sign up for AG Grid new release notifications. Once a new AG Grid version is released, look for the item reference above (AG-XXXX) on the changelog page to see if it's resolved in that version:
https://www.ag-grid.com/ag-grid-changelog/

This issue is in a legacy repository which will be deleted soon. This is why I have closed this issue. If you want to report any new issues, please report them under the main repository to ensure any issues you submit will be processed promptly and seen by the entire AG Grid community.

Thanks again for bringing this up with us - we appreciate your time!