Open oyvindlille opened 12 years ago
Figured out the search part, but still problems with the filtering.
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.
Thanks for the reply, Luis! I've tried to do myself but failed ;) My skills are not as good as yours ;)
Hi Luis-Almeida, Any news on the v1.0 release? I would really love to have the "or" functionality... Thanks!
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();
};
Awesome Product! Waiting for v1.0 release :+1:
First of all - great product! But I'm trying to change it a bit to fit my use.. So a couple of questions: