Question: The documentation is sparse, and I'm something like noob - can someone confirm the correct (if there is one) way of binding Backbone.Views to instances of Backbone. RelationalModel (from backbone-relational.js) for updating / rendering in dom? I tried several different approaches based on the usual Model / View binding in Backbone, with little success.
History of the background (/ more):
I study the ropes with Backbone.js, and last week I had to pick a lot. If I miss something obvious (which is very likely - including the “right” way to deal with my problem below), please call me.
I am dealing with a REST interface supported by mongodb (I do not have full control over - or I would reconsider server-side behavior), which greatly affects nested dictionaries, so I "I read about how to best represent this in Backbone ( without violating the work with large save files () + servers provided by Backbone).
I saw two options: backbone-relational and ligament.js .
I started with backbone-relational.js and had RelationalModels (a basic relational replacement for the Backbone base model) created for various dictionaries in the tree that are returned by the REST interface. Relationships between them are defined, and console JSON logging from each model (in their respective initialization functions) shows that they are all correctly called / loaded from the server with the fetch () command at the general collection level.
So all this is great.
: "" ( , dom), "" ( ...). fetch(), , " " dom, , " " " ", ( , , ).
.
Raynos ( Raynos!):
url UpperLevelCollection UpperLevelModels, (UpperLevelCollection url)/(UpperLevelModel id) , LowerLevelCollections JSON UpperLevelModel ? , , (, , ) // ?
[{
"some_key": "Some string",
"labels": ["A","List","Of","Strings"],
"content": [{
"id": "12345"
"another_key": "Some string",
"list": ["A","list","of","strings"],
},{
"id": "67890"
"another_key": "Some string",
"list": ["A","list","of","strings"],
}],
}]