如何从嵌套数组中进行收集?这就是数组之前的样子:
var OrdersCollection = Backbone.Collection.extend({
model: OrderModel,
url : '/api/orders',
});
var OrderModel = Backbone.Model.extend({});
var orders = this.model;
this.collection = new OrdersCollection(orders);
现在我的数组如下:
所以我必须从行内的数组中进行收集...感谢您的帮助!
答案 0 :(得分:0)
使用.parse
var OrdersCollection = Backbone.Collection.extend({
model: OrderModel,
url : '/api/orders',
parse: function(response) {
return response.rows;
}
});