我正在使用twitter引导程序链接。当用户点击链接时,会出现一个引导模式。 现在由于模态渲染的一些bootstrap技术困难,我需要分离链接并将模式从navbar div中移出。如何将骨干网集合呈现为两个视图
所以考虑我有两个单独的div
<div id="linkDiv">
</div>
和
<div id="modalDiv">
</div>
现在我只有一个视图,这使得服务器的调用获取集合
app.View.FriendRequestListView = Backbone.View.extend({
templateModalLink: _.template($('#link').html()),
templateModal: _.template($('#modal').html()),
tagName: 'div',
initialize: function(){
this.friendRequestCollection = new app.Collection.FriendRequestCollection();
this.friendRequestCollection.bind("reset", this.render, this);
this.friendRequestCollection.fetch();
},
render: function() {
$(this.el).html(this.templateModalLink({
friendRequestCollection: this.friendRequestCollection}));
return $(this.el);
},
});
比我可以只渲染一个格如下
var list = new app.View.FriendRequestListView();
$('#linkDiv').html(list.$el);
我的问题是,是否有可能在同一时间呈现两个模板和两个模板添加到不同的DIV例如像在我的情况我想更新 templateModalLink模板linkDiv和templateModal模板modalDiv与我从服务器获取的集合。
能否请您阐述更 –