1
저는 ArrayController가 있습니다. 특정 키 값을 기반으로 ArrayController의 내용을 그룹화하고 싶습니다.Ember.js : ArrayController의 그룹화/파티셔닝
예를 들어, 내 ArrayController의 개체 인 경우 :
id status name
-----------------------------
1 1 some name
2 1 some other name
3 2 blah
4 3 blah again
은 그 때 나는
status
에 의해 그룹에 내용을하고 싶습니다. 나는에 지정된 ItemController의에 의해 포장되는 템플릿에서
App.SomeArrayController = Ember.ArrayController.extend({
itemController: 'some-item',
status1: Ember.computed.filterBy('content', 'status', 1),
status2: Ember.computed.filterBy('content', 'status', 2),
status3: Ember.computed.filterBy('content', 'status', 3)
});
는, 이러한
표시되고 있지만,이 하지 같습니다 이 작업을 수행하려면, 내 ArrayController에서 계산 된 속성을 사용하여 시도 ArrayController :
// item controller used in the ArrayController
App.SomeItemController = Ember.ObjectController.extend({
anotherKey: function() {
return 'hey ' + this.get('name');
}.property('name')
});
<!-- template to display status=1 items -->
{{#each status1}}
// displays the name (as a property from the model)
{{this.name}}
// nothing displays here
// (leading me to believe it is not being wrapped by the item controller)
{{this.anotherKey}}
{{/each}}
내가 뭘 잘못하고 있니?