Template#rendered

Hello all,

I’m using amsul datepicker port by robertlowe and it require the following block to be included. My question, I don’t see Template#rendered on Blaze documentation but it’s working fine. I try to change it to onRendered and onCreated, but not working.

Why is that? Is #rendered obsolete? If true, what is the correct replacement? Please advice, thank you.

Template.mytemplate.rendered=function() {
    $('.datepicker').pickadate();
}

That’s the (really) old syntax – try:

Template.myTemplate.onRendered(function () {
  $('.datepicker').pickadate();
});

Hi,

I tried “onRendered” and “onCreated” before post question here. Both not working. The date picker doesn’t work.

Any idea?

This is the addon: https://atmospherejs.com/robertlowe/pickadate

Can you post your onRendered code that isn’t working?

Hi,

I found the reason for it not to work. It’s the syntax issue. Cause I just change the “rendered” to “onRendered” without remove the “=” and replace with ( ).

Now I have removed and replace with the correct syntax and it’s working fine now. Thanks.

1 Like

I used to have the same problem before, It is on render or is rendered so I use Tracker on any change and then attach jquery after.