Skip to content

Instantly share code, notes, and snippets.

@steve-ross
Created November 25, 2015 17:05
Show Gist options
  • Save steve-ross/a3df6a74d3256bc554e5 to your computer and use it in GitHub Desktop.
Save steve-ross/a3df6a74d3256bc554e5 to your computer and use it in GitHub Desktop.
autorun
Template.afSelect_semanticUI.onRendered(function() {
let node = this.$(this.firstNode);
node.dropdown(_.extend({
fullTextSearch : this.data.atts.fullTextSearch || false,
allowAdditions : this.data.atts.allowAdditions || false,
maxSelections : this.data.atts.maxSelections || false,
allowCategorySelection: this.data.atts.allowCategorySelection || false,
useLabels : this.data.atts.useLabels === false ? false : true
}, this.data.atts.settings));
this.autorun((c) => {
let data = Template.currentData();
let prevData = {value: null};
if (data.value && data.value !== prevData.value) {
prevData.value = data.value;
node.dropdown("set selected", data.value);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment