tabset中tab的主干el?

时间:2014-07-27 07:05:08

标签: backbone.js tabs

应该将哪些html元素类(或id)传递给一个视图,该视图显示在tabset的选项卡上? 某些代码可能更多地解释了这一点:

            this.articleModel = new Article.Model1();
            this.articleView = new ArticleView.View({
                model: this.articleModel
            });

            this.new_article = new Article.Model();
            this.new_article.fetch();
            this.editorView = new EditorView.EditorView({
                el : $('.tab2_area')
                ,model: this.new_article
                });

            this.tabset = new Backbone.UI.TabSet({ 
                el : $('.tab_example')
                ,alternatives : [{
                    label: 'tab1'
                    ,content: this.articleView.el
                    }
                ,{
                    label: 'tab2',
                    content: this.editorView.el
                    }       
            });

和相应的html模板:

<body>

<div id = "middle" style = "float: right; width: 80%; height: 100%;">
    <div class="tab_example">
        <div class="tab2_area"></div>
    </div>
</div>

没有el:$(&#39; .tab2_area&#39;)视图返回:     TypeError:element为null     element.parentNode.insertBefore(elementToInsert,element.nextSibling);

我在该视图中使用了xing-wysihtml5。

1 个答案:

答案 0 :(得分:0)

尝试

content : this.editorView.$el.html()