mercredi 1 juillet 2015

Search if is a match and ignore Caps and Space

I build a filtering for my app that uses a search box. I have a problem that everytime I type Caps or I add space the search box filtering does not occur. I want to be able to filter not matter the circumstance. If the character is a match 'Filtered'.

{{input type="search" value=theFilter placeholder="ID, group name..."}}

theFilter: null,

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




Aucun commentaire:

Enregistrer un commentaire