Closed jamiepittock closed 10 years ago
Similarly, I'm also struggling to filter a single checkbox.
I want to use a criteria like this:
toptrail: ['#toptrails_filter:checkbox', 'is_toptrail']
This would be a checkbox looking like this:
<input type="checkbox" id="toptrails_filter" value="y">
Clicking the checkbox filters the results to only show the items with JSON attribute is_toptrail with a value of 'y' but unchecking it again hides all the items rather than showing them all again.
I'm not sure whether it's me just not understanding or I'm missing something obvious?
First point select box: There is two to do it.
var selectFilter = function(category_value, type){
if(category_value == ''){
return true;
}else{
return category_value == type
}
};
//in setting options
type: ['#type_filter .TYPE.select', 'type'],
type: ['#type_filter .TYPE.select', 'type', {'all': ''}]
From second point I understood that you want 'OR' filter means if no one is selected show all elements for this you have to set in settings or remove this option, by default it is or filter.
and_filter_on: false
If you trying to do something else please tell.
Thanks very much for the fast response.
I defined a custom filter which worked nicely.
Also changing the and_filter_on setting worked for the other issue.
Many thanks.
I'm using a select field as a filter
I can't work out how I'd basically reset the filter if you select the "Any type" option.
Could you point me in the right direction?