var infoTemplate = new InfoTemplate("Attributes", "${*}");
arcgis for js中,氣泡(InfoTemplate)裡的内容一般是定制的,裡面要顯示哪些字段,格式如何,都可以定制。
但如果事先不知道每個圖層有哪些字段呢,怎麼展示?
辦法就是全部展示,氣泡中展示所有字段内容。
如何展示所有字段内容?
方法就是文章開頭第一句。
什麼場景試用這種耍潑的做法?
var layer = new ArcGISDynamicMapServiceLayer("圖層位址");
var sublayerId = 子圖層ID;
var templates = {};
var t = new InfoTemplate("子圖層名稱", "${*}");
templates[sublayerId + ""] = { infoTemplate: t };
layer.setInfoTemplates(templates);//