I'm trying to pass results into a component and then have the component sort it:
// data passed to component
{
type: 'people',
res : [
{name: 'charlie', age: '55'},
{name: 'bobby', age: '19'},
{name: 'raymond', age: '39'}
]
}
// component
App.ShowResultsComponent = Ember.Component.extend({
// note sure how to set up array controller
sorted : Ember.ArrayProxy.create({
content : this.get('results.res')
}),
)}
my jsbin
I'm not sure if I'm missing/misunderstanding some fundamental, but is it possible to include an array controller as a property in a component? Any clarification would be appreciated.
You can also extend the component with Ember.SortableMixin
, then use arrangedContent
as you normally would in a controller.
App.ShowResultsComponent = Ember.Component.extend(Ember.SortableMixin, {
...
});
Here is your JSBin updated for Ember 1.9.1 and using the Sortable Mixin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With