lundi 25 septembre 2017

Ember control does not come back to loop after sending action

In my Ember app, I have the following code to remove checked rows dynamically

removeRow: function(row){
    // Some logic to remove one row at a time
    var numberContainers = this.get('containers').length;
    for (var i = 0; i < numberContainers; i++){
    }
}

this.get('containers').forEach(function(container){
    if (container.applicable === true){
        var row = {};
        self.send("removeRow", row);
    }
})

Now user can select multiple rows & try removing them. With the above code, the "removeRow" action is invoked only once i.e. the forEach loop somehow gets broken or control does not come back again after the "removeRow" action is invoked once.

How can I handle this scenario ?




Aucun commentaire:

Enregistrer un commentaire