使用ArcGis Api显示InfoWindo

时间:2018-07-25 14:10:15

标签: javascript api arcgis esri

大家好,我实际上使用ArcGsi JavaScript API从事地理应用程序,我正在寻找当用户单击搜索栏中的建议菜单以显示特定内容时运行的方法 功能InfoWindow

1 个答案:

答案 0 :(得分:0)

有几种方法。 第一个鼠标拖动选项;

  var services = new FeatureLayer("http://blablabla/MapServer/0", {
        // mode: FeatureLayer.MODE_SNAPSHOT,
        // infoTemplate: popupTemplate,
        outFields: ["NAME", "ID", "VALUE"]
    });
    services.on("mouse-over", function (evt) {

        var t = "<div class='title'><b>${NAME}</b></div><p>${ID}<br>${VALUE}<br>${VALUE}<br><strong>value: </strong>${VALUE}</p>";

        var content = esriLang.substitute(evt.graphic.attributes, t);
        //var highlightGraphic = new Graphic(evt.graphic.geometry, highlightSymbol);
        //map.graphics.add(highlightGraphic);

        dialog.setContent(content);

        domStyle.set(dialog.domNode, "opacity", 1);
        dijitPopup.open({
            popup: dialog,
            x: evt.pageX,
            y: evt.pageY
        });
    });
    services.on("mouse-out", function (evt) {

        closeDialog();
    });

还是第二次。点击图片;

  var services = new FeatureLayer("http://blablabla/MapServer/0", {
       mode: FeatureLayer.MODE_SNAPSHOT,
        // infoTemplate: popupTemplate,
        outFields: ["NAME", "ID", "VALUE"]
    });

    services.on("click", function (evt) {

        var name = evt.graphic.attributes.NAME;
        var value = evt.graphic.attributes.VALUE;

        // your custom html
        $("#SevicesContainer").collapse("show");
        $("#SevicesContainer").draggable({ containment: "map", scroll: false });
        $("#SevicesContainer .close").click(function () {
            $("#SevicesContainer").collapse("hide");
        });

    });