I have limited knowledge of Backbone.js and I am having some troubles in applying the concepts of Model
and Collections
for the project.
On the server/database side, it is designed that: users can CRUD a list of Category
's which is like a Backbone.js's Collection
s. Under Category
, users can CRUD Worksheet
s. Under Worksheet
, users can CRUD Item
s.
Should I have Worksheet
as a Collection
or a Model
? Or can I have a Collection
of Items
inside a Model
of Worksheet
? If so, how can I do that?
Also, apart from the usual CRUD RESTful operations, what is the best way to implement ordering/sorting of Model
s within a Collection
using Backbone.js with REST? I want the Item
s to be able for users to sort within the Worksheet
. I've read a few Backbone.js tutorials, they mostly cover the CRUD operations and not something else like sorting.
May be I have missed something but I just don't understand the point of Collection
, there is a fetch
method under Collection
but can I fetch all Model
s under one particular Collection
using a collection id? Tutorials don't cover something like this....