Improvements to selectization

This commit is contained in:
Simon Brooke 2018-07-15 12:41:07 +01:00
parent 54029c2941
commit 7dfff9f9ee
2 changed files with 14 additions and 6 deletions

View file

@ -1,11 +1,12 @@
/**
* selectize one select widget. Substitute the actual id of the widget for `{{widget_id}}`.
* selectize one select widget. Substitute the actual id of the widget for `{{widget_id}}`,
* and the current value for {{widget_value}}.
*/
$('#{{widget_id}}').selectize({
valueField: 'id',
labelField: 'name',
searchField: 'name',
options: [],
hideSelected: false,
create: false,
load: function(query, callback) {
@ -25,4 +26,4 @@ $('#{{widget_id}}').selectize({
}
});
}
});
})[0].selectize.setValue({{widget_value}}, true);