laptop and a wrench

漏洞

A pop-up throws an invalid content type error when clicking the GraphicsLayer that does not have a PopupTemplate class defined.

上次发布: October 21, 2016 ArcGIS API for JavaScript
漏洞 ID 编号 BUG-000097999
已提交July 23, 2016
上次修改时间June 5, 2024
适用范围ArcGIS API for JavaScript
找到的版本4.0
操作系统N/A
操作系统版本N/A
状态Will Not Be Addressed

附加信息

Tested against 4.1 and can not reproduce.

解决办法

Option A Define the graphics within the graphics collection of the view as shown in the sample at https://developers.arcgis.com/javascript/latest/sample-code/get-started-graphics/index.html The blank pop-up or the error is no longer displayed. Option B Wire into the view's click event. Perform a hit-test and check if the intersecting layer belongs to the layer that the user did not define a PopupTemplate against. If needed, hide the html for the pop-up from the user interface. An example of the code for this approach is shown below. Note that the pop-up does not appear, but the error still occurs. view.on("click", function(evt){ // Search for graphics at the clicked location view.hitTest(evt.screenPoint).then(function(response){ if(response.results[0].graphic){ console.log("Top graphic found! Here it is: ", response.results[0].graphic); document.getElementsByClassName("esri-popup")[0].style.display = response.results[0].graphic.layer.id == "layer-2" ? "none" : "block"; } }); });

重现步骤

漏洞 ID: BUG-000097999

软件:

  • ArcGIS API for JavaScript

当漏洞状态发生变化时获得通知

下载 Esri 支持应用程序

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项