James R.
James R.

Reputation: 840

listview filter ONLY on server-side (prevent JQM from filtering again)

I have a listview that I only want filtered on the server-side. I have implemented code very similar to this example:

http://demos.jquerymobile.com/1.4.0/listview-autocomplete-remote/

The problem is, I do not want jQuery Mobile to filter the results after I have already filtered them on the server because it will hide valid results from the user.

For example my requirement is that '%' (percent sign) is a wild card in the search text. So if I entered '%PP%', an item with the name "APPLE" will be returned in the results. BUT, jQuery Mobile comes after me and says, "No-no-no, APPLE is filtered out because it does not contain the percent signs!"

I've thought about removing the data-filter="true" and placing my own filter bar on top of the listview myself. But, that seems like overkill if I could find a way to make this work.

Bottom line: How do I stop jQuery Mobile from re-filtering the results that I have already filtered?

Upvotes: 0

Views: 224

Answers (1)

ezanker
ezanker

Reputation: 24738

You could use the filtercallback option and just always return false:

$(".selector").filterable('option', 'filterCallback', function(idx, searchValue){
    return false; 
});

Upvotes: 1

Related Questions