我有一个使用ArcGIS JS API的Web应用程序,其中包含一系列自定义微件。如果我将esri/dijit/editing/TemplatePicker
放置在Accordion容器选项卡中的ContentPane内(该选项卡处于非活动状态),则当页面加载时,模板选取器无法正确呈现。
重现步骤:
1.加载提琴(http://jsfiddle.net/n9jwtgko/1/)
1.切换到第一个折叠面板。该小部件只是一个边框,没有任何内容
1.现在通过设置selected="true"
更改选定窗格
<div data-dojo-type="dijit/layout/ContentPane" title="Heeh, this is a content pane" selected="true">
<div id="templatePickerDiv"></div>
</div>
1.从第二个容器中取出selected="true"
1.使小提琴恢复活力
小部件现在可以正确加载。
这里到底发生了什么?我该如何解决这个问题?
3条答案
按热度按时间qoefvg9y1#
有时候当我使用“Dojo”时,我改变了一些东西,但我不知道为什么。它是这样工作的。“parse.parse()”部分在代码结束后运行。
Here is fiddle
6l7fqoea2#
仔细查看HTML文件后(autoSelect=true和without),我可以看到,如果没有autoSelect=true,您的网格没有得到正确的宽度。这是HTML版本的网格。如果您看到元素'dojoxGridHeader',宽度是0px,但与autoSelect=true一样,它将变成“width= 178px”。2所以检查你CSS,当雅阁的容器加载时,你也可以使用grid.startup()。3希望能有所帮助。
bmvo0sr53#
问题似乎真的出在templatepicker或Accordion上,如果我从应用程序中删除其中一个,它就能正常工作,所以我的计划是确保解析器只在所有事情都完成后才运行-包括像
layers-add-result
这样的事件。由于我的应用程序已经模块化为mapLoader、小部件、服务等,所以我决定将mapLoader重构为延迟对象。
现在有了这些,我可以直接在启动文件中调用:
到目前为止,这是我找到的唯一一种方法,可以确保在解析器实际运行并执行其黑魔法之前加载每个小部件。当然,现在我只需要清理所有内容,并用Dojo实现替换jQuerys的deferred对象。