简体   繁体   English

在使用href加载为dojox.layout.contentpane的HTML页面中定义的自定义窗口小部件,并作为选项卡页面插入而不解析自定义窗口小部件

[英]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. 在尝试使用href属性创建dojox.layout.contentpane之后,我尝试以编程方式使用tab.addchild添加新的标签页。

Following is the sample snippet of the relevant code ( tabMain is tab control placed in the page) 以下是相关代码的示例代码片段( tabMain是放置在页面中的Tab控件)

  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). country.jsp具有自定义小部件(包含两个标准dijit小部件)。
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. 但是自定义窗口小部件没有被解析,因此我无法正确加载自定义窗口小部件,就像country.jsp提到的其他标准dijit完美加载一样。

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. 为了排除页面和自定义窗口小部件声明的问题,我将此自定义窗口小部件直接放置在页面中,而无需在contentpane / tab内部加载(并在内部以对话框页面的形式加载),效果很好。 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. 因此,当我将其加载到内容窗格中时,我假设dojo解析器没有解析该自定义窗口小部件,如上面的代码所示。

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). 在不了解DOJO的情况下,您提供的代码段缺少ContentPane构造函数调用内的ContentPane括号,从而使其无效(因此不可解析)。

Try: 尝试:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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