luis-almeida / filtrify

Beautiful advanced tag filtering with HTML5 and jQuery
Other
644 stars 113 forks source link

Search the list and filtering method #14

Open oyvindlille opened 12 years ago

oyvindlille commented 12 years ago

First of all - great product! But I'm trying to change it a bit to fit my use.. So a couple of questions:

  1. Do you know of a way to easily search the container instead of the categories?
  2. Right now if you tick off Action and Adventure under genre, you get movies that are tagged both Action and Adventure. But is it possible to get to show movies that are tagged with just Action even when both Action and Adventure is ticked off?
oyvindlille commented 12 years ago

Figured out the search part, but still problems with the filtering.

luis-almeida commented 12 years ago

Hi!

Sorry for the late reply! It is possible to achieve what you want but you'd have to tweak the filter function. This is something I was already asked about and I'm thinking of including an option that enable that type of filtering: "disjunction". This will probably be implemented in the next release, which is going to be v1.0.

oyvindlille commented 12 years ago

Thanks for the reply, Luis! I've tried to do myself but failed ;) My skills are not as good as yours ;)

philippeluickx commented 11 years ago

Hi Luis-Almeida, Any news on the v1.0 release? I would really love to have the "or" functionality... Thanks!

philippeluickx commented 11 years ago

Am I correct if in the bellow function, you need to replace c >= this._query[f].length with c >= 1 in order to have "or" working (but then for every filter)? So if passing an extra parameter in this fucntion would be possible, you can define if you do "and" or "or", include that in a if/else

Filtrify.prototype.filter = function () {
var f, r, t, c, m;

this.resetCachedMatch();

for ( r = this._matrix.length - 1; r >= 0; r-- ) {

m = true;

for ( f in this._query ) {

c = 0;

for ( t = this._query[f].length - 1; t >= 0; t-- ) {
if ( $.inArray( this._query[f][t], this._matrix[r][f] ) !== -1 ) {
c = c + 1;
};
};

if ( !this._query[f].length || c >= this._query[f].length ) {
// match!
} else {
m = false;
};

};

this.updateFields( r, m );
this.cacheMatch( r, m );
this.showMatch( r, m );

};

this.rewriteFields();

this.callback();

};
spyder86 commented 11 years ago

Awesome Product! Waiting for v1.0 release :+1: