简体   繁体   中英

Custom widget defined in an HTML page loaded as dojox.layout.contentpane using href and inserted as tab page not parsing custom widgets

I was trying to add a new tab page using tab.addchild programmatically after creating dojox.layout.contentpane with href attribute.

Following is the sample snippet of the relevant code ( tabMain is tab control placed in the page)

  dijit.byId('tabMain').addChild(new dojox.layout.ContentPane({
     title: 'My page',
     href: 'country.jsp',
     closable: true,
     parseOnLoad: true,
     postCreate: function () {
         dojo.parser.parse();
     }));

This country.jsp has custom widget (that contain two standard dijit widgets).
But the custom widgets are not parsed and hence I am not getting the custom widget properly loaded, where as other standard dijits mentioned in the country.jsp loads perfectly.

To rule out the problem with my page and custom widget declarations, I put this custom widget directly in a page without loading inside a contentpane/tab (and loaded inside as dialog page), it works fine. So, I assume that the dojo parser is not parsing the custom widget, when I load it in the content pane as shown in the above code.

Does this mean, custom widget cannot be used for such type of loading or Am I missing anything extra to force the parser to work? I tried running parser on load, downloadend, downloadstart, ready events, but with no luck.

Any help would be appreciated.

Without knowing anything about DOJO, your provided snippet is missing a closing bracket inside the ContentPane constructor call, making it invalid (and thus not parsable).

Try:

dijit.byId('tabMain').addChild(new dojox.layout.ContentPane({
    title: 'My page',
    href: 'country.jsp',
    closable: true,
    parseOnLoad: true,
    postCreate: function () {
        dojo.parser.parse();
    }
}));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM