Hi,
I'm using CanJS 1.1.
I have a tabs Control and each tab has a Resources control. The tabs "state" is represented by an Observe object.
In my tabs Control, I render a "placeholder", e.g. "<div class='resources'></div>",and I want to create a new resources control with this DIV. So I need the control initialisation code to run whenever a new placeholder is rendered. At the moment, I have an event handler (Line 12) that listens to the tabs Observe, but the problem is that this runs before the rendering and I need it to run after.
Any thoughts would be appreciated.
- init: function(){
- var _this = this;
- ......
- _this.element.html(can.view("//imsportal/controllers/resources_tabbed/views/tabs.ejs", {tabs: _this.options.tabs, items: _this.options.items}));
- var filterOptionsPromise = Portal.Filters[_this.options.tab_by].getFilterOptions();
- filterOptionsPromise.done(function(options){
- _this.options.tabs.replace(options);
- });
- }
- ,
- "{tabs} length": function(){
- var _this = this;
- _this.element.find(".resources").each(function(){
- new Portal.Resources(this, {});
- });
- }
Thanks,
Bryon