2
我想在一个视图内获取多个集合。我有仪表板,其中有两个表格。一艘用于船舶,另一艘用于发货日。首先,我只需要在仪表板中提取船只的集合。它已经完成了,现在我也必须以相同的观点取得发货日的集合,这在目前非常具有挑战性。我希望得到你们的帮助。 这使得两个集合互相混淆在一起。提前致谢。如何在一个视图中获取多个集合
我想在一个视图内获取多个集合。我有仪表板,其中有两个表格。一艘用于船舶,另一艘用于发货日。首先,我只需要在仪表板中提取船只的集合。它已经完成了,现在我也必须以相同的观点取得发货日的集合,这在目前非常具有挑战性。我希望得到你们的帮助。 这使得两个集合互相混淆在一起。提前致谢。如何在一个视图中获取多个集合
Parse.User.current().get('host').relation('ships').query().collection().fetch().then(collectionFetchSuccess, collectionFetchError);
Parse.User.current().get('host').relation('shipdays').query().collection().fetch().then(collectionFetchSuccess, collectionFetchError);
像卡兰在评论area.You需要调用第二集中在第一个系列的回调函数获取提到的取
Parse.User.current().get('host').relation('ships').query().collection().fetch({
success : function(collection){
shipFetchSuccess(collection)
Parse.User.current().get('host').relation('shipdays').query().collection().fetch().then(shipdaysFetchSuccess, collectionFetchError)
},
error : function(){
collectionFetchError()
}
})
,你需要编辑collectionFetchSuccess了。因为它需要两个集合,尽管它只有一个参数。
var shipdaysFetchSuccess = function(collection) {
var shipdaysView = new ShipdaysTableView({ collection: collection });
self.subViews.push(shipdaysView);
self.$el.find('.shipdays').html(shipdaysView.render().el);
};
var shipFetchSuccess = function(collection) {
var shipsView = new ShipsTableView({ collection: collection });
self.subViews.push(shipsView);
self.$el.find('.ships').html(shipsView.render().el);
};
太棒了! :) :) :) – Kazi
您需要从处理第一个集合的回调函数Success中调用第二个Collection的get方法。 –
@KaranPatyal请实际执行一些解决方案。 – Kazi