如何定義爲CompositeView
TemplateNotFoundError:無法呈現,因爲模板的錯誤,null或undefined
define(function (require) {
"use strict";
var _ = require('underscore'),
Marionette = require('backbone.marionette'),
Row = require('app/views/Dam/row'),
tpl = require('text!tpl/Dam/table.html'),
template = _.template(tpl);
return Marionette.CompositeView.extend({
tagName: "table",
className: "table table-bordered",
initialize: function (opt) {
this.ev = opt.ev;
},
childView: Row,
childViewContainer: function(){
return "tbody"
},
childViewOptions: function (model, index) {
return {
ev: this.ev
}
},
onRender: function() {
this.ev.trigger('App:Loading:Hide', true);
}
});
});
模板這是CompositeView中的Marionette.Region一個孩子。我只是像這樣觸發它region.show(new CompositeView)
。我正在使用最新的Backbone以及木偶。
您需要添加模板。閱讀[this](http://marionettejs.com/docs/marionette.compositeview.html)。 – 2014-10-02 11:32:00
我跟隨[這](http://marionettejs.com/docs/marionette.compositeview.html#compositeviews-childviewcontainer),但我用requirejs加載模板 – Muhaimin 2014-10-03 02:11:18