mardi 30 juin 2015

Refresh model with queryParam inside a function

I have a queryParams itemCount which is set to refreshModel: true. When I change this param, it triggers the model hook. The problem I have is I want to trigger the model hook in a function which depends on the newly retrieved content.

function :

loadUrlConvStatus: function(status){
        this.send('filterConversations', status);
        convCtrl = this.get('controllers.conversations');
        var convs = convCtrl.get('content').get('content')<--- Retrieved content;

        while(!this.get('convInLot')){

            var convs = convCtrl.get('content').get('content')<--- Content isnt changed right away

            for(j=convCtrl.get('itemCount'); j < convCtrl.get('itemCount') + 10; j++){
                if(convs[j].id == getCurrentConvId()){
                    this.set('convInLot', true);
                }
            }

            convCtrl.send('getMore');<----this function changes the param itemCount.
            **Model should then be refreshed. Model hook isn't triggered right away when I call it**
        }
    }

It is annoying because it only triggers the model hook only after it goes out of my function when I want to evaluate it right away (the variable convs retrieves the content).




Aucun commentaire:

Enregistrer un commentaire