Allowing groups on select2 component

This commit is contained in:
Bruno Alves de Faria committed 2017-07-12 09:18:17 -03:00
1 parent 0f30648646
commit 150817d711
1 file changed
+13 -3
@@ -8,11 +8,21 @@
{{this.tagAttributes}} {{this.tagAttributes}}
> >
{{>UI.contentBlock}} {{>UI.contentBlock}}
{{#each item in (reactive this.items)}} {{>baseSelectOptions this.items}}
</select>
</template>
<template name="baseSelectOptions">
{{#each item in (reactive this)}}
{{#if item.items}}
<optgroup label="{{item.label}}">
{{>baseSelectOptions item.items}}
</optgroup>
{{else}}
<option <option
value="{{item.value}}" value="{{item.value}}"
selected="{{#if eq item.value (reactive this.value)}}selected{{/if}}" selected="{{#if eq item.value (reactive this.value)}}selected{{/if}}"
>{{item.label}}</option> >{{item.label}}</option>
{{/each}} {{/if}}
</select> {{/each}}
</template> </template>