jeudi 9 juillet 2015

search filtering not working properly

I build a simple search filter. The problem I have is that when I typed the first time the filtering works perfectly but when I empty the search input the data from the filtering that happen stays there.it Should disappears right after there is no text in the search input. Thank you.

theFilter: "",
filterHotel: function() {
    var model   =  this.get('model'),
        theFilter = this.get('theFilter').toLowerCase().trim();
        return model.filter(function(hotelRequest){
                return (hotelRequest.get('inquiry.name') && hotelRequest.get('inquiry.name').indexOf(theFilter) != -1)
                    || (hotelRequest.get('inquiry.id') == theFilter);  
        });
}.property('theFilter'),

Aucun commentaire:

Enregistrer un commentaire