-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[POC] KPI Infinite scroll AgGrid #519
base: main
Are you sure you want to change the base?
Conversation
…i_optimise_ag_grid_load
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @petar-qb - thanks for the quick investigation! 🚀
I would like to keep this PR open as a draft for discussion when @antonymilne is back, but I wouldn't like to merge it into the kpi dashboard if this can only be implemented when we turn off filtering and sorting.
The page with the ag-grid doesn't have any controls on purpose, as it looks nicer if the table takes up all space and people don't have to switch between the side panel and main panel. But that's why we do need the filtering and sorting functionality on that table. I would prefer the slower speed over not having filtering/sorting enabled in this case.
I am sure you have looked at this @petar-qb, but just in case you had not seen: https://dash.plotly.com/dash-ag-grid/infinite-scroll#infinite-scroll-with-sort-and-filter Would this work? |
@maxschulz-COL Thanks for pointing this out (I forgot even though I saw it). I don't know how good idea it is to push this code for the demo example (since its complexity could confuse our users and repeal them to use Vizro). However, let me investigate how generic this code is on Monday. If it is, maybe we can implicitly enable this code if the infinite scroll is turned on. |
for more information, see https://pre-commit.ci
@maxschulz-COL @huong-li-nguyen @antonymilne The code from the link works 🎉. What do you think, do we want to predefined the |
I am not opposed to having another grid callable, it would be in line with what we are doing for KPI cards. But I think we need to abstract the entire callback logic away. Ideally we also have only a minimum set of defaults. Another route would be to enhance the existing callable for the case that someone chooses infinite scroll: e.g. we could make this an argument of the Overall I think I am in favour if we can prove that this setting improves the performance noticeably. If we can enable it in an easy way, then I think this is exactly what Vizro stands for |
Sorry for the very delayed response to this but hopefully better late than never... 🤞 Just to check we're all on the same page here, I think this is where things stand:
I think @maxschulz-COL was describing above two possible APIs:
In theory I agree with either API, but I'm not sure how easily we can actually implement either one? The main problem I see here is where do you define the callback?
Am I missing something here? If not then next steps here would be to investigate 2, which would be useful anyway due to #109. Footnotes
|
The other thing I'm curious about and maybe @AnnMarieW can answer... Where does all the code in this example come from? How well tested and generic is this? i.e. could we safely apply it to any dataframe, or is it really just suitable for a few representative examples? |
The example is adapted from the example in the AG Grid docs. It's designed to be more generic than that example and should work in most cases. This example was provided by @BSd3v who is the lead developer of dash-ag-grid. Hey Bryan, do you have any other comments? |
Hello, All, While this code is robust, and I believe it will work for most cases, it hasnt been tried on every single dataset, or even a broad spectrum of datasets for that matter. I fear that this could run into some of the enterprise features, such as filter sets and advanced filters. I think if you want to go this route, you have it be a function that can be passed to the component if needed to get more advanced than this, where this first function is set as a default. On a side note, the first post mentions pagination and being clientside. While this is the case in a default setting, it is possible to utilize pagination with an infinite row model as well. Just throwing that out there. 😄 |
Thanks so much for chipping in @AnnMarieW and @BSd3v, very helpful! We are indeed considering doing pagination with the infinite row model and just wondering whether it would be a good idea to build the code in https://dash.plotly.com/dash-ag-grid/infinite-scroll#infinite-scroll-with-sort-and-filter into Vizro. There are other technical problems on the Vizro side here so not sure whether we'll actually end up doing it but would be good to know in principle whether you would mind us doing so @BSd3v? 🙂
This is a very good point and something that had occurred to me too. We'll need to make sure we don't clash with them.
This should indeed be possible through a user defining their own custom AgGrid function, although I imagine in practice not many people would. |
This shouldnt be an issue, the dash-ag-grid library is just a wrapper for AG Grid. Just put tests in place for updates from the library. 😄
You can always give them the base code in your documentation, and demonstrate how to override it. And yes, for the vast majority I dont think there will be an issue. |
For my own tracking - blocked until this is solved: https://github.com/McK-Internal/vizro-internal/issues/1100 |
Is this still relevant based on the new speed optimisations for the Tables and Graph? :) |
Only a half of the "ideally fast ag_grid" problem is solved with the #644. The other half involves enabling server-side pagination e.g. by enabling |
Description
FYI:
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:
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,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:Open Question:
infinite_scroll_dash_ag_grid
public?Screenshot
Notice
I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":