2014-10-02 2 views
0

나는이의 CompositeView는 Marionette.Region의 자식 CompositeViewTemplateNotFoundError은 :부터 템플릿을 렌더링 할 수 없습니다 그 거짓 null 또는 정의되지 않은

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); 
     } 

    }); 

}); 

에 대한 템플릿을 정의하려면 어떻게합니까. 방금 region.show(new CompositeView)처럼 방아쇠를 당깁니다. 최신 백본과 마리오네트를 사용하고 있습니다. 당신이 어떤보기

Marionette.CompositeView.extend({ 

     tagName: "table", 
     template : tpl, 
     ..... 
     ..... 

에 대한 템플릿을 정의로

+0

을 작동합니다. [this] (http://marionettejs.com/docs/marionette.compositeview.html)을 읽으십시오. –

+0

필자는 [this] (http://marionettejs.com/docs/marionette.compositeviews-childviewcontainer)를 따르지만 requirejs를 사용하여 템플릿을로드합니다. – Muhaimin

답변

1

그것은 당신이 템플릿을 추가 할 필요가

+0

다른 오류가 발생합니다 :'UndefinedTemplateError : 템플릿을 렌더링 할 수 없습니다. null이거나 정의되지 않았습니다. ' – Muhaimin

+0

당신은 확실합니까 : tpl/Dam/table.html이 존재합니까? 크롬이나 파이어 버그로 디버깅하고 "tpl"을 보면서 그것이 무엇을 제공합니까? null 인 경우 이것은 수정해야 할 문제입니다. –

+0

이러한 오류는 실제로 내 itemView에 속합니다. – Muhaimin