@valk wrote:
Hi everyone,
I'm noob and I created a working app that renders elements in the component. The elements was a simple array in the model() hook which were passed to the component.
The preparation is:
filteredItems: Ember.computed('optionsFilter,items.length', function() {
var items = this.get('items');
var optionsFilter = this.get('optionsFilter').toLowerCase();
if (optionsFilter != '') {
return items.filter(function(item, index, enumerable){
var iCode = item.code.toLowerCase().indexOf(optionsFilter);
var iDescription = item.description.toLowerCase().indexOf(optionsFilter);
return iCode != -1 || iDescription != -1;
});
} else {
return items;
}
}),However when I moved my elements to the Database (it's Rails and I followed this tutorial) the action when I'm clicking an element isn't working:
actions: {
onItemClick(item) {
var o = this.get('items').removeObject(item);
var chosenItems = this.get('chosenItems');
chosenItems.pushObject(item);
this.set('chosenItems', chosenItems.sortBy('code'));
}
}The problem is,
this.get('items')
gives
Class {store: Class, isLoaded: true, manager: Class, isUpdating: false, __ember1472535443472: "ember319"…}
And that class is not the object I got previously, so how can I get properties of it?
Thank you.
Posts: 1
Participants: 1