Specify an HTML table's element as a region in Marionette for Backbone.js

后端 未结 2 1968
[愿得一人]
[愿得一人] 2021-02-19 04:42

Problem

Using a Backbone.Marrionette.Layout to present some tabular data. The portion of the table is a Backbone.Marionette.R

2条回答
  •  自闭症患者
    2021-02-19 05:15

    Is the intent of this layout solely to facilitate a table? If so, you should look at using a CompositeView instead.

    
    RowView = Marionette.ItemView.extend({
      tagName: "tr",
      template: ...
    });
    
    TableView = Marionette.CompositeView.extend({
      template: ...,
    
      childView: RowView,
    
      childViewContainer: "#list-region"
    });
    

    That's pretty much it. This will render all of your itemViews in to the tbody.

提交回复
热议问题