-
Notifications
You must be signed in to change notification settings - Fork 33
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
Paging quirks #143
Comments
@TimNZ |
@TimNZ I added a potential fix to |
Thanks for the fast turn-around. No change. _fetchDataViaAjax has one call path: render() is called multiple times in the initial render lifecycle and state.rawDataSource is not set before _needsAjaxFetch is called multiple times, and ajaxDataFetch() is of course async allowing this to happen. You could debug the lifecycle to see how to do things alternatively, or do what I did as a hack, your call. For testing I cloned the src and set 'this.doneAjax = true' in _fetchDataViaAjax and changed the needsAjaxFetch check accordingly.
|
@TimNZ Okay. I took the issue to be that the paging and the ajax fetch were both being called. tried a quick fix for that. I will take another look. |
Thanks. Having to implement both func is a separate consideration. I don't find it to be an intuitive implementation choice, and it is not clear in the documentation or from the example how to do paging and that Both handlers are required, so I had to spend a bit of time sussing out the flow. Every ajax mechanism I've used or implemented has one func handler. The return from ajaxDataFetch could indicate if more data is available. |
I agree that it is not ideal. It grew out of two distinct use cases. page fetch from where you have the first page and the ajax for subsequent pages, the other where you made a single ajax fetch for a single page of results. |
@TimNZ Spent some time earlier tonight investigating the double renders. I appreciate you taking the time with the control and your points are valid. Consolidating the ajax handlers and deprecating the separate paging setup would be ideal, but at the moment I do not have the bandwidth to investigate further. I did implement a version of a boolean similar to your doneAjaxFetch solution above to prevent additional fetch calls |
I'll see how I feel about doing a PR next week. |
@TimNZ Going to close this for now |
Is it intentional that you need to implement both ajaxDataFetch and pageDataFetch for paging?
If I DO NOT implement ajaxDataFetch, no page load is triggered on dropdown open until I move the mouse over the dropdown container.
If I DO implement ajaxDataFetch, it is called twice immediately on initial open, twice being one more time than necessary :)
I then have to implement hacky code to ensure I don't increase my nextPage counter in my shared loadData() if it is another call triggered from ajaxDataFetch.
The text was updated successfully, but these errors were encountered: