0

我刚从骨干开始并使用样板(https://github.com/tbranyen/backbone-boilerplate)。我的应用程序分为 3 列:固定导航列表、项目列表和详细视图。单击导航链接时,我会在中间列中加载一组项目。下一步是在单击其中一个项目(集合中的模型)时显示详细视图。

我似乎无法获得要渲染的详细视图。我在列表视图中初始化详细视图,然后在详细视图中设置 pubSub,以便在单击模型时可以调用详细视图。但是,当我尝试渲染视图时,我得到一个“未捕获的 RangeError:超出最大调用堆栈大小”。

相关代码: http: //pastebin.com/C88ezty7

我似乎不明白为什么细节视图无法渲染。

谁能指出我正确的方向?

4

1 回答 1

0

我似乎已经解决了上述问题。可能不是以正确的方式,但它现在正在按我的预期工作。我将此添加到我的查看项目(模型)中:

showDeanery: function(ev) {
    deaneryid = this.model.get('deaneryid');
    //we should load the detail view from here
    console.log('load deanery: '+deaneryid);
    $(".startpage").empty();
    $(".detailcontainer").removeClass('startpage');
    app.layout.insertView('.detailcontainer',new Views.Detail({
            model:this.model
    }),true).render();
}

我希望从另一个视图中调用视图是“好的”。现在只需要弄清楚如何通过路由器加载它!

于 2012-09-04T09:33:50.660 回答