var rules_widgets = {
condition: 'OR',
rules: [{
id: 'date',
operator: 'equal',
value: '1991/11/17'
}]
};
$('#builder-widgets').queryBuilder({
plugins: ['bt-tooltip-errors'],
filters: [{
id: 'date',
label: 'Datepicker',
type: 'date',
validation: {
format: 'YYYY/MM/DD'
},
plugin: 'datepicker',
plugin_config: {
format: 'yyyy/mm/dd',
todayBtn: 'linked',
todayHighlight: true,
autoclose: true
}
}],
rules: rules_widgets
});
$('#btn-reset').on('click', function() {
$('#builder-widgets').queryBuilder('reset');
});
$('#btn-set').on('click', function() {
$('#builder-widgets').queryBuilder('setRules', rules_widgets);
});
$('#btn-get').on('click', function() {
var result = $('#builder-widgets').queryBuilder('getRules');
if (!$.isEmptyObject(result)) {
alert(JSON.stringify(result, null, 2));
}
});