When the onRendered callback is called?


I’m trying to have a reactive bootstrap selectpicker but I have a weird behaviour:
An event has to change the options of the select but it works only after the first event which is not working because the app doesn’t go into the onRendered part…

This is the onRendered part:

var renderTimeout = false;
Template.printerselect.onRendered( function(){
    if (renderTimeout !== false) {
    renderTimeout = Meteor.setTimeout(function() {
        renderTimeout = false;
    }, 10);
Template.printerSetupForm.onRendered( function(){

here, the templates :

       <div class="col-lg-3 col-md-4 col-xs-12 form-group">
                                                    <select id="printerCompany" class="form-control selectpicker" name="printer[company]">
                                                        <option selected="true" disabled="disabled"
                                                                value={{company}}>Please Select
                                                            A Printer Company
                                                        {{#each Companies}}
                                                            <option value="{{company}}" {{printerCompanySelected company}}> {{company}} </option>
                                                <div class="col-lg-3 col-md-4 col-xs-12 form-group">
                                                    <label>PRINTER NAME</label>
                                                    <select id="printerName" class="form-control selectpicker" name="printer[name]">
                                                        <option selected="true" disabled="disabled"
                                                                value={{name}}>Please Select
                                                            A Printer
                                                        {{#each Names}}
                                                            <!--<option value="{{name}}" {{printerNameSelected name}}> {{name}} </option>-->

<template name="printerselect">
    <option value="{{name}}"> {{name}} </option>

The refresh is called when the page is rendered.

Then I change the company which changes some Session variables and reactively to change the name select options but the refresh is not called so that doesn’t come to the onrendered part.

But when I change again the company it’s working, the onRendered part is called.

Weird thing is that even if this is not displaying the right names, when i’m choosing a name which doesn’t match with the company, the select chooses the right one.

Sorry for my english in advance, I did my best.

Thanks you in advance :smile: