本文介绍了dojo 1.8:错误:尝试使用id == main_bContainer注册窗口小部件,但该ID已经注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的如下所示,显示bordercontainer和contentpane。
我不明白为什么bordercontainer的id被注册了两次,因为我为bordercontainer定义了一个
id。



错误说明:错误:尝试使用id == main_bContainer注册窗口小部件,但该ID已经注册
请指教我哪里错了。

 <!DOCTYPE html> 
< html>
< head>
< title> Hello< / title>

< meta http-equiv =Content-Typecontent =text / html; charset = UTF-8/>
< link rel =stylesheethref =../ dojo1_8 / dijit / themes / soria / soria.css/>
< link rel =stylesheethref =../ common.css/>
< style type =text / css>
html,body
{
width:100%;
height:100%;
margin:5px;
padding:0px;
overflow:hidden;
}

< / style>



< / head>

< body class =soria>
< div id =main_bContainerdata-dojo-type =dijit / layout / BorderContainerdata-dojo-props =design:'sidebar'>
< div class =cP_Leftdata-dojo-type =dijit / layout / ContentPanedata-dojo-props =region:'center'>
内容页面A
< / div>
< div class =cP_Rightdata-dojo-type =dijit / layout / ContentPanedata-dojo-props =region:'right'>
内容页面B
< / div>

< / div>
< / body>

< script>
var dojoConfig =
{
parseOnLoad:true,//替换基于主题soria的web控件
isDebug:true,// true for debuggin with FireBug,Always set it为了避免开销
async:true,//
locale:en-us//
};
< / script>

< script src ='.. / dojo1_8 / dojo / dojo.js'>< / script>

< script> require([dojo / parser,
dojo / ready,
dojo / request,
dijit / layout /
dijit / layout / ContentPane,
dojo / domReady!
],function(parser,ready,request)
{ready(function()
{parser.parse();




});
});
< / script>
< / html>

感谢
Clement

解决方案

成为你有 parse()它的2次。



code> dojoConfig = {parseOnLoad:true};



这里 parser.parse();



只需 parse 只有一个问题可以解决。


Hi I have a simple one as shown below that displays bordercontainer and contentpane.I do not understand why the bordercontainer's id is registered twice since I only have one id defined for bordercontainer.

The error stated: Error: Tried to register widget with id==main_bContainer but that id is already registeredPlease advise where I got it wrong.

<!DOCTYPE html>
<html>
<head>
<title>Hello</title>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../dojo1_8/dijit/themes/soria/soria.css"/>
<link rel="stylesheet" href="../common.css"/>
<style type="text/css">
html, body 
{
    width: 100%;
    height: 100%;
    margin: 5px;
    padding: 0px;
    overflow: hidden;
}

</style>



</head>

<body class="soria">
<div id="main_bContainer" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'sidebar'">
    <div class="cP_Left" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">
        Content Pane A
    </div>
    <div class="cP_Right" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'right'">
        Content Pane B
    </div>

</div>
</body>

<script>            
var dojoConfig =
            {
                parseOnLoad: true,//replace web controls based on theme soria
                isDebug: true,//true for debuggin with aid  from FireBug, Always set it to false, to avoid overhead
                async: true,//
                locale : "en-us"//
            }; 
</script>

<script src='../dojo1_8/dojo/dojo.js'></script>

<script>require(["dojo/parser",
             "dojo/ready",
             "dojo/request",
             "dijit/layout/BorderContainer",
             "dijit/layout/ContentPane",
             "dojo/domReady!"
            ], function(parser, ready, request)
            {ready(function()
                {parser.parse();




            });
    });
</script>
</html>

Thanks Clement

解决方案

Becuase you have parse() its 2 times.

Here dojoConfig = { parseOnLoad: true };

and here parser.parse();

Just parse only one the problem will solve.

这篇关于dojo 1.8:错误:尝试使用id == main_bContainer注册窗口小部件,但该ID已经注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 23:40