-
Notifications
You must be signed in to change notification settings - Fork 558
Description
Hi, I'm integrating the query builder into a site I'm working on. It's really great and for the most part easy to work with.
But I've got an issue with the selectize integration. I used the example as a base but even with the example code, all the options are showing up as "undefined".

That's my filter config:
{
id: 'query_theme',
label: 'Theme',
type: 'string',
operators: ['equal'],
plugin: 'selectize',
plugin_config: {
valueField: 'id',
labelField: 'query_theme',
searchField: 'query_theme',
sortField: 'query_theme',
create: true,
maxItems: 1,
plugins: ['remove_button'],onInitialize: function() { var that = this; if (localStorage.demoData === undefined) { $.getJSON('http://querybuilder.js.org/assets/demo-data.json', function(data) { localStorage.demoData = JSON.stringify(data); data.forEach(function(item) { that.addOption(item); }); }); } else { JSON.parse(localStorage.demoData).forEach(function(item) { that.addOption(item); }); } } }, valueSetter: function(rule, value) { rule.$el.find('.rule-value-container input')[0].selectize.setValue(value); } }
I've also included this code from the example:
// Fix for Selectize
$('#builder').on('afterCreateRuleInput.queryBuilder', function(e, rule) {
if (rule.filter.plugin == 'selectize') {
rule.$el.find('.rule-value-container').css('min-width', '200px')
.find('.selectize-control').removeClass('form-control');
}
});
Strangly, the option ids are all there in the source code of the page, but all the labels are somehow undefined. I hope you can help me with this.