0
我是Backbone的新手,我試圖單擊工具欄上的按鈕(位於工具欄div上),該按鈕被稱爲「新建」。 單擊後,我想要在id =「app-list」的另一個div上打開一個新面板。如何在主幹上創建嵌套模板
但在新的按鈕按下時,它總是覆蓋「的應用程序列表」 DIV
這裏是我的代碼(我使用的骨幹網和CoffeeScript的):
class MyApp.Views.ToolbarAppView extends Backbone.View
el: "#toolbar-app"
events: "click #add_new": "newApp"
newApp: (e) ->
myapp = new MyApp.Models.App
@model = myapp
newPanel = new MyApp.Views.NewAppView({ el: @$el, model: @model, parent: @})
newParent.render()
class MyApp.Views.NewAppView extends Backbone.View
template: JST["myapp", "new_app_view"]
render: ->
fieldsPanel = new MyApp.Views.EditAppView({ el: @$el, model: @model, parent: @})
fieldsPanel.setElement('#app-list').render()
class MyApp.Views.EditAppView extends Backbone.View
template: JST["myapp", "edit_app_view"]
tagName: "tr"
className: "edit_data"
render: ->
@$el.html(@template({ el: @$el, model: @model, parent: @})