You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 17, 2018. It is now read-only.
When reseting the fullCollection with new models, the "state" (most specifically the totalRecords) are updated after the pageableCollection is reseted (backbone-pageable line 475-477).
In my case, the scenario is the following: If I have a pagination Backbone.View (renders the pagination controls for navigating - forward, back, pages number) listening to the "reset" event in the pageableCollection, it will be rendered with the previous state when a reset is done. That could be true for the event "remove" as well, but I still have to check that.
My tentative fix is the below code. I will add a test to demonstrate the issue.
If I understand this issue correctly, you have an event listening that needs to access the state of the collection and you need all the states to be updated when u access them? This can be tricky since Backbone event handlers are applied backwards. So add, remove, reset, sort are all affected...
Actually I was wrong, event handlers are fired in order in Backbone.
I think this problem is caused by the PageableCollection event handler is listening on all and the state is updated inside the all event handler, but all is fired after all the other more granular event are fired first so if you are listening to those, you don't see the updated state.
Ok this will take me a while to fix. For now I think you should listen to all and detect the event type passed instead as a workaround. It will be forward compatible even after I've made the fix.
When reseting the fullCollection with new models, the "state" (most specifically the totalRecords) are updated after the pageableCollection is reseted (backbone-pageable line 475-477).
In my case, the scenario is the following: If I have a pagination Backbone.View (renders the pagination controls for navigating - forward, back, pages number) listening to the "reset" event in the pageableCollection, it will be rendered with the previous state when a reset is done. That could be true for the event "remove" as well, but I still have to check that.
My tentative fix is the below code. I will add a test to demonstrate the issue.
The text was updated successfully, but these errors were encountered: