Я пытаюсь установить класс моего представления itemViewClass на основе атрибута содержимого значения.Установка класса в элементе CollectionView на основе значения элемента
Приведенный ниже код:
<span id="ember326" class="ember-view spanValue">
<h5>
<script id="metamorph-32-start" type="text/x-placeholder">
Select
<script id="metamorph-32-end" type="text/x-placeholder">
</h5>
</span>
класс установлен в «spanValue» вместо значения от содержания.
Любые идеи?
спасибо.
listHeaderView: Ember.CollectionView.create({
classNames: ['jobs-list-header', 'row'],
content: [
Ember.Object.create({
span: 'span1',
label: 'Select'
}),
Ember.Object.create({
span: 'span1',
label: 'Status'
}),
Ember.Object.create({
span: 'span1',
label: 'Tax Year'
}),
Ember.Object.create({
span: 'span3',
label: 'Municipality'
}),
Ember.Object.create({
span: 'span3',
label: 'School District'
}),
Ember.Object.create({
span: 'span1',
label: 'Received'
})
],
itemViewClass: Ember.View.extend({
tagName: 'span',
classNames: ['spanValue'],
spanValue: function() {
return this.get('content').span
}.property(),
template: Ember.Handlebars.compile('<h5>{{content.label}}</h5>')
})
}),
Спасибо, что помогли. – dgaj
classNameBindings также могут использовать глубокие пути, поэтому вы можете привязываться к 'content.span' вместо того, чтобы создавать для него локальное свойство. –