dojo 1.8: Error: Tried to register widget with id==main_bContainer but that id is already registered

匿名 (未验证) 提交于 2019-12-03 02:33:02

问题:

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 registered Please 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

回答1:

Becuase you have parse() its 2 times.

Here dojoConfig = { parseOnLoad: true };

and here parser.parse();

Just parse only one the problem will solve.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!