I have to initialize a dropdown inside a each / with block. The main problem is that it’s not rendered at all. I initialize the component with jQuery, $(’.dropdownClass’).dropdown() and it’s not working. I tried to put the initialization in onRendered, onCreated and forcing it into a HTML script tags.
Moreover, I need to give the dropdown default values from DB, so I need to get the data first from DB and then assign it to the values in the dropdown.
Any tips?
It helps a bit, but what I’m asking for (maybe I explained bad my problem haha) it’s not to BUILD the component with some data from DB, it’s RENDER the component once another DB is subscribed like:
{{#if Template.subscriptionsReady}}
{{#each collection1}}
<script>$('.dropdownClass').dropdown();</script> // This doesn't work
<select>
{{#each collection2 as option}} // This works
<option value="{{option.value}}">{{option.name}}</option>
{{/each}}
</select>
{{/each}}
{{/if}}