Javascript 主干视图未显示,未显示错误

Javascript 主干视图未显示,未显示错误,javascript,backbone.js,Javascript,Backbone.js,我有一个奇怪的问题,我的主干视图没有显示,我没有得到任何错误。我已经遵循了我之前的程序,这些程序对发球台非常有效,但似乎没有什么对这种观点起作用 我很困惑为什么它不起作用希望你们中的一个人能看到发生了什么 如果我仔细阅读代码,模型将被正确提取,并且其中包含数据 main.js this.absences = new AbsenceCollection({idC:id},{option: 0}); this.absences.fetch({success: functi

我有一个奇怪的问题,我的主干视图没有显示,我没有得到任何错误。我已经遵循了我之前的程序,这些程序对发球台非常有效,但似乎没有什么对这种观点起作用

我很困惑为什么它不起作用希望你们中的一个人能看到发生了什么

如果我仔细阅读代码,模型将被正确提取,并且其中包含数据

main.js

  this.absences = new AbsenceCollection({idC:id},{option: 0});
            this.absences.fetch({success: function(){

                $('#contents').html( new AbsenceListView ({model: app.absences}).render.el,id);

            }});
window.AbsenceListView = Backbone.View.extend({


    tagName:'table',


    initialize:function () {

        this.model.bind("reset", this.render, this);
        var self = this;

        this.model.bind("add", function (absence) {
            $(self.el).append(new AbsenceListItemView({model:absence}).render().el);
        });
    },

    render:function (eventName) {

        _.each(this.model.models, function (absence) {
            $(this.el).append(new AbsenceListItemView({model:absence}).render().el);
        }, this);
        return this;
    }
});

window.AbsenceListItemView = Backbone.View.extend({

    tagName:"tr",

    initialize:function () {
        this.template = _.template(tpl.get('absence-table'));
        this.model.bind("change", this.render, this);
        this.model.bind("destroy", this.close, this);
    },


    render:function (eventName) {
        $(this.el).html(this.template(this.model.toJSON()));
        return this;
    }

});
缺席列表.js

  this.absences = new AbsenceCollection({idC:id},{option: 0});
            this.absences.fetch({success: function(){

                $('#contents').html( new AbsenceListView ({model: app.absences}).render.el,id);

            }});
window.AbsenceListView = Backbone.View.extend({


    tagName:'table',


    initialize:function () {

        this.model.bind("reset", this.render, this);
        var self = this;

        this.model.bind("add", function (absence) {
            $(self.el).append(new AbsenceListItemView({model:absence}).render().el);
        });
    },

    render:function (eventName) {

        _.each(this.model.models, function (absence) {
            $(this.el).append(new AbsenceListItemView({model:absence}).render().el);
        }, this);
        return this;
    }
});

window.AbsenceListItemView = Backbone.View.extend({

    tagName:"tr",

    initialize:function () {
        this.template = _.template(tpl.get('absence-table'));
        this.model.bind("change", this.render, this);
        this.model.bind("destroy", this.close, this);
    },


    render:function (eventName) {
        $(this.el).html(this.template(this.model.toJSON()));
        return this;
    }

});
缺勤模式

window.Absence = Backbone.Model.extend({

        //SIMS/resource/class datatables http//localhost:8080

   baseURL: "http://localhost:8080/SIMS/resource/absence",
            url: function() {
                return this.baseURL + '/' + idClass + '/' + option;



            },    

             initialize: function(attributes, options){

          option = options.option;
          idClass = attributes.idC;

      },



    defaults: {

                  "week":"",
                  "StudentidStudent":"",
                  "classidClass":"",
                  "monday":"",
                  "tuesday":"",
                  "wednesday":"",
                  "thursday":"",
                  "friday":""

      }



});

window.AbsenceCollection = Backbone.Collection.extend({
    model: Absence,

         baseURL: "http://localhost:8080/SIMS/resource/absence",
            url: function() {
                return this.baseURL + '/' + idClass + '/' + option;



            },


                  initialize: function(attributes, options){
          option = options.option;
          idClass = attributes.idC;

      }




});

Render是一个返回该值的函数,因此如果链接正确,只需将Render.el替换为

render().el

.render.el
应该是main.js中的
.render().el
。谢谢,我一直盯着这段代码看了很久,很想注意到什么。这会引起一个错误。请添加一个答案,我会将其标记为正确。Alex收到了
.render
是对函数的引用
.render.el
将导致
未定义
,但不会出现错误<代码>$(..).html(未定义)只会删除内容。JSHint可能有助于理解这一点。您还可以尝试在JS中启用严格模式。