0

something like this:

var cp = new ContentPane({
                    title: self.friends_data.data[index].name,
                    closable: true,
                    onClose:function(){
                        conf = confirm("Do you really want to Close this?");
                        if (conf){
                            self.friends_tabs[index] = null;
                            return true;
                        }
                        return false;
                    },
                    content: newTabTemplate
                });

where newTabTemplate is:

<div>
            <span data-dojo-type="dijit.layout.AccordionContainer" style="min-width: 1em; min-height: 1em; width: 100%; height: 100%;">
              <div data-dojo-type="dijit.layout.ContentPane" title="Write testimonial for friend" doLayout="false">
                <div data-dojo-type="dijit.Editor" data-dojo-attach-point="editor" data-dojo-props="onChange:function(){console.log('editor1 onChange handler: ' + arguments[0])}, extraPlugins:['foreColor','hiliteColor','fontName', 'fontSize', 'formatBlock', 'createLink', 'unlink', 'insertImage', {name: 'fullscreen', zIndex: 900}]" height=90% style=""></div>
                <!--
                dojo.connect(dijit.registry.byNode(editor1.toolbar.containerNode.children[editor1.toolbar.containerNode.children.length-1]), "onChange", function(x){alert('hello')});
              -->
              </div>
              <div data-dojo-type="dijit.layout.ContentPane" title="Read their testimonial for you" doLayout="false">
              </div>
            </span>
</div>

Now, I want cp.editor to work because in there is an attach point named editor in cp's template. but it says undefined. Any way around that?

The instantiation happens correctly i.e. the visual output is correct, only attach point is not working.

prongs
  • 9,422
  • 21
  • 67
  • 105
  • How is the dojo parser invoked? `parseOnLoad=?` in the HTML or do you parse explicitly yourself? – Paul Grime Apr 04 '13 at 11:34
  • @PaulGrime `parseOnLoad=true` in dojo config. So no explicit parsing – prongs Apr 04 '13 at 11:36
  • Can you try turning off parseOnLoad and parsing yourself? Maybe attach points only work for custom widgets, else you might have to mix-in this functionality into your `cp` object - https://dojotoolkit.org/reference-guide/1.8/dijit/_WidgetsInTemplateMixin.html. – Paul Grime Apr 04 '13 at 11:42
  • Ok, the mixin method worked. Add it as an answer, I'll accept. – prongs Apr 04 '13 at 11:52

1 Answers1

0

Add the widgets-in-template functionality to cp as a mix-in, as I believe ContentPane does not have this functionality by default.

https://dojotoolkit.org/reference-guide/1.8/dijit/_WidgetsInTemplateMixin.html

Paul Grime
  • 14,970
  • 4
  • 36
  • 58
  • so I defined a custom widget extending from `ContentPane` and set its `templateString` accordingly. Simple! – prongs Apr 04 '13 at 12:27