Open
Description
I am looking for a way to implement a modulo operator, but I am not sure what might be the way to do so.
When selecting the modulo op the resulting rule should display something like this (please ignore the first and last select, the image is taken from the current implementation):
The idea is to model operations like:
field % value = 5
field % value > 10
....
I've been able to add the modulo operator but all the fields are now shown as inputs for numbers:
(function() {
var QueryBuilder = jQuery.fn.queryBuilder,
operators = QueryBuilder.defaults('operators'),
operatorsAsArray = Object.keys(operators).map(function (key) {return operators[key]});
operatorsAsArray.push({
type: 'modulo',
nb_inputs: 3,
apply_to: ['number']
});
QueryBuilder.defaults({operators: operatorsAsArray});
})();
Is there a way to specify custom inputs or a template for an operator?