amrali / bootstrap-select-meteor

Meteor packaging for Bootstrap-Select
11 stars 3 forks source link

Selectpicker stays after routing with iron:router #8

Open benjamin79 opened 10 years ago

benjamin79 commented 10 years ago

when i select another page which is routed with iron:router the select is visible on every page.

please help.

David-Durst commented 10 years ago

I had the same issue. I fixed it by adding a hook to my router clearing out all the bootstrap-select elements on page change. To implement, put the following in somewhere in your project where your client will get it:

function clearBootstrapSelects() {
    $('.bootstrap-select').remove();
    this.next();
}

Router.onBeforeAction(clearBootstrapSelects);

This is a bit of a hack but it should be fine if you only ever creating a limited number of bootstrap-select elements per page.