#16889 closed feature (fixed)
Add _detachTemplateNodes function to _AttachMixin
Reported by: | Nick Fenwick | Owned by: | bill |
---|---|---|---|
Priority: | undecided | Milestone: | 1.9 |
Component: | Dijit | Version: | 1.9.0a2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
_AttachMixin in 1.9 trunk has an _attachTemplateNodes function that sets up this._attachPoints and this._attachEvents, but there is no function to call to easily tear them down again. That code is in destroyRendering().
Our use case is that we have server generated content that contains dijits and attach point markup. We need a way to set that HTML to the dom, have it parsed and its attach points processed. If this is to be repeatable, the old attach points must be torn down somehow.
Our _setContentAttr function currently looks like this:
return declare(_AttachMixin, { /* When our content is being replaced, detach our attach points * and remove our current DOM, then create the new content and * place it where the old content used to be. */ _setContentAttr: function(content) { this._detachTemplateNodes(); html.set(this.domNode, content); //parser.parse(this.domNode); this._attachTemplateNodes( this.domNode, function(n,p){ return n.getAttribute(p); }); // Allow _WidgetsInTemplateMixin to attach dijits in this template this._beforeFillContent(); // hook for _WidgetsInTemplateMixin // Force startup to be called on e.g. TabContainers in our template // _WITM will have created them, but not called startup(), so // TabContainer et al don't fully set up. // Could also set _earlyTemplatedStartup, see _WITM. this.startup(); this.parent.resize(); },
To support this behaviour, we need the _AttachMixin._detachTemplateNodes function that I had in my local copy while developing http://trac.dojotoolkit.org/ticket/16576
Attachments (1)
Change History (4)
Changed 8 years ago by
Attachment: | 16889.patch added |
---|
comment:2 Changed 8 years ago by
Milestone: | tbd → 1.9 |
---|
Patch to _AttachMixin.js on dijit trunk.