I'm using Backbone and Underscore. My objects look something like:
TopObject: {
name: '',
middleObjects: []
}
MiddleObject: {
name: '',
bottomObjects: []
}
BottomObject: {
name:'',
someOtherProp: ''
}
So basically if you have one topObject, it will have multiple middle objects as one of its properties, and the middleObjects will have multiple bottomObjects as one of its properties.
I'm not really sure how I can display these fields in a table. So I got this far using underscore.
var someTopObject = new TopObject(); // that has real data
_.each(someTopObject.get('middleObjects'), function (midObjs) {
// do something with MidObj.name
// not sure how to get midObjs.bottomObjects
});
Right now I Know that bottomObjects can only have 2 items. So I guess I could hardcode getting the first and second object in bottomObjects, but I was unsure if there was a more elegant way. Thanks!