Ember.js #each-how中嵌套子视图上的动态类绑定?

Ember.js #each-how中嵌套子视图上的动态类绑定?,ember.js,Ember.js,我有一个单独的视图,每个辅助对象都有一个类似的视图: <table class="select-sect" cellspacing="0"> {{#each sections}} <tr {{bindAttr class="highlight:highlight"}} {{action "selectSection" }}> <td class="key"> {{#each zones}} <em {{bindAttr style

我有一个单独的视图,每个辅助对象都有一个类似的视图:

<table class="select-sect" cellspacing="0">
{{#each sections}}
<tr {{bindAttr class="highlight:highlight"}} {{action "selectSection" }}>
  <td class="key">
    {{#each zones}}
      <em {{bindAttr style="color"}}>&nbsp;</em>
    {{/each}}
  </td>
  <td class="sect">{{name}}</td>
  <td class="price">{{currency lowPrice}} - {{currency highPrice}}</td>
</tr>
{{/each}}
</table>
因为我需要处理每行上的一些其他事件,所以我已将整个表行迁移到嵌套视图中。我正在寻找一种方法,使动态类像以前一样工作

{{#each sections}}
{{#view SYOS.SelectSectionRowView sectionBinding="this" }}
  <td class="key">
    {{#each section.zones}}
      <em {{bindAttr style="color"}}>&nbsp;</em>
    {{/each}}
  </td>
  <td class="sect">{{section.name}}</td>
  <td class="price">{{currency section.lowPrice}} - {{currency section.highPrice}}</td>
{{/view}}
{{/each}}
使用类绑定查看:

{{#view SYOS.SelectSectionRowView sectionBinding="this" classBinding="needsHighlight"}}
在视图类中:

needsHighlight: function () {
  if (this.section.highlight) {
return 'highlight';
  }

return '';
} .property('section'),
这两种方法似乎都不管用。有人能洞察如何让这样的场景继续下去吗


多谢

尝试classNameBindings:['section.highlight:highlight']

{{#view SYOS.SelectSectionRowView sectionBinding="this" classBinding="needsHighlight"}}
needsHighlight: function () {
  if (this.section.highlight) {
return 'highlight';
  }

return '';
} .property('section'),