Note that there are some explanatory texts on larger screens.

plurals
  1. POMeteor on collection change update Template select element
    primarykey
    data
    text
    <p>I am using <a href="http://silviomoreto.github.io/bootstrap-select/" rel="nofollow"><code>bootstrap-select</code></a> to help make select elements look better in my Meteor app.</p> <p>However, I am running into an issue where upon submitting changes to the Meteor Collection, the reactivity pushes out changes back to the templates, thus rewriting the select elements and destroy the original select element, which also take away the <code>bootstrap-select</code> stuff.</p> <p>I wonder if there's a way for me to prevent this from happening somehow. I tried to listen to the changes and recall <code>selectpicker</code> upon an update but it doesn't work. </p> <pre><code>Applications.find().observe({ changed: function() { console.log('something changed'); $('.selectpicker').selectpicker(); } }); </code></pre> <p>I even try to delay things a little bit, also to no avail.</p> <pre><code>Applications.find().observe({ changed: function() { console.log('something changed'); setTimeout(function(){ $('.selectpicker').selectpicker(); console.log('trying to update select picker'); }, 1000); } }); </code></pre> <p>Has anyone run into this problem before and know how to fix it?</p> <p>EDIT: Here's the template code</p> <pre><code>&lt;div class="form-group"&gt; &lt;label for="college" class="control-label"&gt;College/ University&lt;/label&gt; &lt;select class="selectpicker" name="college" placeholder="Select a College/ University"&gt; {{#each colleges}} &lt;option value="{{slug}}"&gt;{{name}}&lt;/option&gt; {{/each}} &lt;/select&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload