像現在我有一個返回集合數據:修改集合導致骨幹
[{'category':1,
'title':"Current Company",
'people':{"count":2,
"keyword":"",
"executiveInfos":[{"name":"Darren Suomi",
"title":"Global Vice President of Sales",
"companyId":2867257,
"employmentId":10993552,
"executiveId":10152454,
"imageUrl":"https://d1tzls7byl3ryp.cloudfront.net/iv/profileImages/executiveImage/321446",
"count":0,
"executiveConnectionImageUrls":[],
"trackedByWatchlists":[],
"employmentType":0},
{"name":"Gregory Gunn",
"title":"Vice President of Business Development",
"companyId":2867257,
"employmentId":9240823,
"executiveId":9049103,
"imageUrl":"https://d1tzls7byl3ryp.cloudfront.net/iv/profileImages/executiveImage/292479",
"count":0,
"executiveConnectionImageUrls":[],
"trackedByWatchlists":[],
"employmentType":0}]***}
},
{'category': 2,
'title':"Former Company",
'people':{"count":0,
"finance":0,
"otherFunction":0,
"keyword":"",
"executiveInfos":[]}
},
{'category': 4,
'title':"Family Tree Company",
'people':{"count":0,
"keyword":"",
"executiveInfos":[]}
}
]
在數據上,它有3個類別,每個類別有一個人屬性命名,現在我 要列出我的列表視圖是:
var PeopleListView = Backbone.View.extend({
el: $('.bucketContent'),
initialize: function(){
this.listenTo(this.collection, 'reset', this.render);
}
render: function() {
this.collection.each(function($model) {
var itemview = new PeopleItemView({model : $model});
this.$el.prepend(itemview.render().el);
}, this);
return this;
}
});
我該怎麼辦?謝謝。
你有什麼試過?你需要迭代集合中的模型,然後對每個模型迭代'model.people.executiveInfos'。 –