-
Notifications
You must be signed in to change notification settings - Fork 252
Reset not setting state back to first page. #293
Comments
I would assume the best way to handle this is to listen to the collection reset event and in the handler do |
Resetting a PageableCollection has the same semantics as resetting a plain Backbone.Collection, it merely clears the data view, no underlying state is changed as a result. Resetting doesn't mean refetch. If you want to refetch, call one of those get* methods. |
none of the get* methods reset the links list for infinite mode, so there is currently no practical way to reset state. |
A common pattern in Backbone apps is to reset a collection vs. re-instantiating it. This allows all the upfront wiring of that collection to views to continue to function properly without losing the reference. Without being belt to use |
I want to understand the usage pattern before I make a change. There are many scenarios when we talk about the constitution of resetting the |
This is my use case. I basically instantiate a collection and wire it up to some views. Those views then listen for various events (including reset). I use reset as a means of modifying that collection contents without needing to re-wire all the views. Think of a results page that can be modified by facet selection. I don't want to re-instantiate the results view when the collection contents changes. |
Are you using PageableCollection as a general substitute for Backbone.Collection? Generally you'd only ever want to reset when paging, for which there are get* methods you can call, or you can call fetch directly. The only reason I brought up resetting the state back to first instantiation was some people would like to set the current page to, say 3 on instantiation, and for some reason they'd like to reset back to that. |
Only the models get reset when I call
reset
. The cursor does not move thestate
back to the firstPage. Is this by design and is there a recommended way to handle this?The text was updated successfully, but these errors were encountered: