问题
使用Backbone.Marrionette.Layout呈现一些表格数据。 所述<tbody>
表中的部分是Backbone.Marionette.Region ,是为了显示Backbone.Marionette.CollectionView 。
我无法弄清楚如何在不插入内部的额外HTML元素搞乱了桌面显示器做到这一点使用木偶的“地区” <tbody>
元素。
示例代码
该Layout
是这样的:
Backbone.Marionette.Layout.extend({
template:...
regions:{
list_region: '#list-region'
}
onRender:function(){
var collection = new TheCollection()
var collectionView = new TheCollectionView({
collection: collection
})
// PROBLEM: The region seems to needs its own HTML element,
// and the CollectionView also seems to need its on HTML
// element, but as far as I can see, there is only room
// for one element: <tbody>?
this.list_region.show(collectionView);
});
布局的模板包括整个表:
<table>
<tbody id='list-region'>
</tbody>
<tfoot id='footer-region'>
Some other stuff goes here that is not a collection, so I was able
to make the View's 'tagName' property 'tr', which worked fine.
</tfoot>
</table>
有什么建议?