Jquery UI datepicker stops working when you move from one layout to another in an app


#1

I am not sure how to get around this or if this is a bug in meteor but if I have a template that appears under two different layouts (I use iron router)

This code for datepicker

Template.new_event.rendered = function (){
 this.$('.datepicker').datepicker({
  dateFormat: "yy-mm-dd"
 });
}

does not work. If I land on a page that uses the “new_event” template and it is using a different layout from the one that last used the “new_event” template the datepicker command does not trigger and no errors are posted. Also I have tried using different templates (doing rendered calls on different templates), but once I go to a page that calls “datepicker” and go to another page that calls “datepicker” it does not trigger if the page is a different layout

Any help with this would be greatly appreciated