Daniel
Daniel

Reputation: 607

Attach points in dijit.Dialog, when using template as content

I am instantiating a dijit.Dialog programmatically and want to set a form as the content. This is defined in a HTML template, which I load like:

"dojo/text!./templates/CustomTabControllerEditGroupDialog.html",

and set during construction:

var myDialog = new Dialog({ ... content: template, ... });

Now I want to have data-dojo-attach-points and -events in my template, but I don't get where they point to. How do I do this? I know the issue of extending a dialog is an ongoing discussion, but I honestly think I should be possible to display a form programmatically without creating a new Dialog widget. BR, Daniel

Upvotes: 1

Views: 1416

Answers (1)

Craig Swing
Craig Swing

Reputation: 8162

Instead of setting the html template as the content, create a custom widget that uses the template and set an instance of the widget as the dialog content. Attach points in the template will become variables on the widget.

http://dojotoolkit.org/reference-guide/1.9/dijit/_TemplatedMixin.html

http://dojotoolkit.org/reference-guide/1.9/dijit/_AttachMixin.html#dijit-attachmixin

Upvotes: 3

Related Questions