vizro
vizro copied to clipboard
[POC] KPI Infinite scroll AgGrid
Description
- Implementation of AgGrid infinite-row-model for the KPI example due to speedup.
FYI:
- Dash AgGrid pagination stores all data on the client side. Therefore, the recommended implementation for big data is to use
infinite row model
. The downsides of this approach are that the sorting and filtering interface options must be set to False (disabled) (because only a small part of the source data is visible on the client side).
Additionally:
- For the further optimisation of the initial page loading, we should:
- or reimplement the
Page.pre_build()
so it doesn't trigger the on_page_load mechanism if there are only tables and grids and without any controls on the page, - or we should reimplement the AgGrid/Table to initially return an empty pd.DataFrame.
- or reimplement the
- The new custom ag-grid (
infinite_scroll_ag_grid
) implementation is introduced since the predefined one (dash_ag_grid
) doesn't allow to skip the following code execution which significantly slows down the page loading time:
...
"rowData": data_frame.apply(
lambda x: (
x.dt.strftime("%Y-%m-%d") # set date columns to `dateString` for AG Grid filtering to function
if pd.api.types.is_datetime64_any_dtype(x)
else x
)
).to_dict("records"),
...
Open Question:
- Should we make the
infinite_scroll_dash_ag_grid
public?
Screenshot
Notice
-
[x] I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":
- I submit this contribution under the Apache 2.0 license and represent that I am entitled to do so on behalf of myself, my employer, or relevant third parties, as applicable.
- I certify that (a) this contribution is my original creation and / or (b) to the extent it is not my original creation, I am authorized to submit this contribution on behalf of the original creator(s) or their licensees.
- I certify that the use of this contribution as authorized by the Apache 2.0 license does not violate the intellectual property rights of anyone else.
- I have not referenced individuals, products or companies in any commits, directly or indirectly.
- I have not added data or restricted code in any commits, directly or indirectly.