我主要对不起我的英语。 Backbone js我想要选择的每个列表,并且在循环中只显示一个值。我怎样才能做到这一点 ?我将向您展示示例代码。如果您有一个您不理解的地方,请询问。
提前感谢您的帮助。
Backbone 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();
},
HTML代码;
<ul class="list-group">
{{#each rowList}}
<li data-id="{{./this}}" class="list-group-item list-row">
{{{var this ../this}}} <br>
</li>
{{/each}}
</ul>