Javascript 主干js在html中只显示每个列表的一个元素

Javascript 主干js在html中只显示每个列表的一个元素,javascript,backbone.js,espocrm,Javascript,Backbone.js,Espocrm,我主要为我的英语感到抱歉。我希望选择每个列表,并在循环中仅显示一个值。我该怎么做?我将向您展示示例代码。如果您不了解某个地方,请询问 提前感谢你的帮助 主干JS代码 _template: '<div class="list-container">{{{list}}}</div>', defaultListLayout: { rows: [ [ {

我主要为我的英语感到抱歉。我希望选择每个列表,并在循环中仅显示一个值。我该怎么做?我将向您展示示例代码。如果您不了解某个地方,请询问

提前感谢你的帮助

主干JS代码

    _template: '<div class="list-container">{{{list}}}</div>',


    defaultListLayout: {
        rows: [
            [
                {
                    name: 'entityType'
                },
                {
                    name: 'calculationType'
                },
                {
                    name: 'calculationValue'
                },
                {
                    name: 'queryType'
                }
            ]
        ]
    },

    afterRender: function () {
        this.collection = new MultiCollection();
        this.collection.seeds = this.seeds;
        this.collection.url = 'CareerSteps/action/careerGoal';
        this.collection.maxSize =         this.getConfig().get('recordsPerPageSmall') || 5;
        this.collection.data.entityTypeList = this.scopeList;            
        this.listenToOnce(this.collection, 'sync', function () {
            this.createView('list',         'career:views/dashlets/templates/newtemplate', {
                el: this.options.el + ' > .list-container',
                pagination: false,
                type: 'list',                    
                checkboxes: false,
                collection: this.collection,
                listLayout: this.listLayout,
            }, function (view) {
                view.render();
            });
        }, this);

        this.collection.fetch();
    },
<ul class="list-group">          
    {{#each rowList}}
        <li data-id="{{./this}}" class="list-group-item list-row">        
          {{{var this ../this}}} <br>        
        </li>
    {{/each}}
</ul>
\u模板:{{{{{list}}},
defaultListLayout:{
行:[
[
{
名称:“entityType”
},
{
名称:“calculationType”
},
{
名称:“calculationValue”
},
{
名称:“queryType”
}
]
]
},
afterRender:函数(){
this.collection=new MultiCollection();
this.collection.seeds=this.seeds;
this.collection.url='CareerSteps/action/careerGoal';
this.collection.maxSize=this.getConfig().get('recordsPerPageSmall')|| 5;
this.collection.data.entityTypeList=this.scopeList;
this.listenToOnce(this.collection,'sync',函数(){
this.createView('list','career:views/dashlet/templates/newtemplate'{
el:this.options.el+'>.list容器',
分页:false,
键入:“列表”,
复选框:false,
收藏:这个收藏,
listLayout:this.listLayout,
},功能(视图){
view.render();
});
},这个);
this.collection.fetch();
},
HTML代码

    _template: '<div class="list-container">{{{list}}}</div>',


    defaultListLayout: {
        rows: [
            [
                {
                    name: 'entityType'
                },
                {
                    name: 'calculationType'
                },
                {
                    name: 'calculationValue'
                },
                {
                    name: 'queryType'
                }
            ]
        ]
    },

    afterRender: function () {
        this.collection = new MultiCollection();
        this.collection.seeds = this.seeds;
        this.collection.url = 'CareerSteps/action/careerGoal';
        this.collection.maxSize =         this.getConfig().get('recordsPerPageSmall') || 5;
        this.collection.data.entityTypeList = this.scopeList;            
        this.listenToOnce(this.collection, 'sync', function () {
            this.createView('list',         'career:views/dashlets/templates/newtemplate', {
                el: this.options.el + ' > .list-container',
                pagination: false,
                type: 'list',                    
                checkboxes: false,
                collection: this.collection,
                listLayout: this.listLayout,
            }, function (view) {
                view.render();
            });
        }, this);

        this.collection.fetch();
    },
<ul class="list-group">          
    {{#each rowList}}
        <li data-id="{{./this}}" class="list-group-item list-row">        
          {{{var this ../this}}} <br>        
        </li>
    {{/each}}
</ul>
    {{#每个行列表}
  • {{{var this../this}}}}
  • {{/每个}}

您在数组中有一个数组
行:[[
所以您需要两个循环。但是您似乎只有一个循环。或者这是一个错误?非常感谢您解决了这个问题。我已经解决了。