Allowing groups on select2 component

This commit is contained in:
Bruno Alves de Faria 2017-07-12 09:16:05 -03:00
parent 0f30648646
commit 150817d711

View File

@ -8,11 +8,21 @@
{{this.tagAttributes}}
>
{{>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
value="{{item.value}}"
selected="{{#if eq item.value (reactive this.value)}}selected{{/if}}"
>{{item.label}}</option>
{{/each}}
</select>
{{/if}}
{{/each}}
</template>