Adding Two Lists To Selectize, The First One Should Be Selected By Default
Hi I've a litle problem with selectize, namely how to add two lists and he first one should be selected by default and enduser can select items from second list in same form. Below
Solution 1:
You need to use items
to provide an array of values for the options that should be selected by default (instead of using two options
arrays). Option values are determined by your valueField
setting.
For example:
$('#select-id').selectize({
items: ['1', '2'], // preselected options values
options: [
{ value: '1', name: 'Item 1' }, // this option will be preselected
{ value: '2', name: 'Item 2' }, // this option will be preselected
{ value: '3', name: 'Item 3' },
{ value: '4', name: 'Item 4' }
],
valueField: 'value',
labelField: 'name',
searchField: ['name'],
delimiter: ',',
select: true,
create: true,
maxItems: null
});
Post a Comment for "Adding Two Lists To Selectize, The First One Should Be Selected By Default"