mercredi 23 mars 2016

remove items from array with the same id one by one

the problem is that I have multiple objects with the same id. As ou can see this works when it comes to removing all the items with the same id. How I can remove the objects one by one no matter if they are the same ID...thanks

individualObjects:[],
actions:{
   increment:function(){
      var obj = this.get('object');
      this.get('individualObjects').pushObject(obj);
   },
   decrement:function(){
      var obj = this.get('object');
      var filter = this.get('individualObjects').findBy('obj_id', obj.get('obj_id'));
      this.get('individualObjects').removeObject(filter);
   }
}




Aucun commentaire:

Enregistrer un commentaire