I have a UI with a form that has dropdowns andcheckboxes in order to filter the results returned from the server.
I wonder if I have to create a Model in order to keep the current settings available or just get the vals with jquery and pass them to the Collections fetch.
What would be better?
That dependes how much you want to invest in design, or you just can live with a more pragmatic approach.
If you run for the design solution we can say that there is not a
Collectionof results what we are playing with here. It is aFilterSearchmodel, and every time we are sending the filter params to the server what we are doing is creating an instance ofFilterSearch. Let’s say:The server will take this request and will return the array of results. Let’s say:
The Backbone
FilterSearchmodel will be updated with the info responded by the server:And from there we can create our results
Collection:(All code is simplified and not tested)