Issue reactive Select2
OkorumDev2 opened this issue · comments
Hi, We are trying to use select2 with reactivity. however, although we are using publish and subscribe, the reactivity is not working. but the way the select2 is loading well but it is not being reactive. On the other hand if we use a normal select, the reactivity working well. Any ideas?
Events.js
Template.name_template.onCreated(function(){
Meteor.subscribe('name_Publish');
});
Template.name_template.onRendered(function(){
$("select.js-Select2Test").select2();
});
Helpers.js
import {collection_name} from '/Path';
Template.name_template.helpers({
testHelpers: function(){
return collection_name.find();
},
});
Template.html
{{#each testHelpers}} {{this._id}} - {{this.description}} {{/each}}you could get reactivity if you use an autorun in onRendered that would update the options in the select2 - by default, the options are read only once when the select2 element is inited