I have a meteor pattern displaying some html that I need to execute a jquery function. Right now, I have configured the dependency, so every time the data (list of objects) attached to this template changes, the function starts. I'm not at all sure that this is the best way to do what I'm trying to do, but it runs the function every time I add / remove / reorder objects to start.
However , the function seems to work before the template is re-rendered, so the previous set of blocks will get jquery-fied, but any blocks that I just added in this action are not.
Is there a way to get the function to run AFTER the template is rendered / updated? Any help is much appreciated!
(a similar question here is Meteorite jet jquery - but it has no answers)
Here are some possibly relevant code bits:
Template.showPictures.rendered = Deps.autorun () -> album = Albums.findOne(Session.get("selectedAlbum")) if (album) pictures = album.orderedPictures() MyApp.loadJQuery() Template.showPictures.helpers pics: -> MyApp.myDependency.depend() album = Albums.findOne(Session.get("selectedAlbum")) album.orderedPictures()
(Why is autostart in my Template.rendered article? Not sure. It seemed okay, but this is the first time I'm really dealing with dependencies, so I could be completely out of the database. Ideas about what goes wrong will be excellent .)
source share