如何获取图形属性键?
How to get graphic attribute keys?
GLayer = new esri.layers.GraphicsLayer();
var graphic = new esri.Graphic(point, symbol);
name = "test";
graphic.setAttributes({"name" : name});
GLayer.add(graphic);
我创建了一个图形层。图形被添加到图形层。
图形由点和符号组成。
我在图形中创建了一个属性。
怎么得到图形所有属性的key呢?
或者是否可以知道图形属性中特定键的存在与否?
Read the documentation before posting please。这是 graphic.attributes
.
除了阅读文档,您还可以使用 console.log(graphic)
将对象转储到控制台,在那里您可能会发现它有一个 attributes
参数,或者您可以使用调试工具在其中一行设置断点并检查 graphic
对象以查看其所有键。请先尝试做自己的研究和调查。
GLayer = new esri.layers.GraphicsLayer();
var graphic = new esri.Graphic(point, symbol);
name = "test";
graphic.setAttributes({"name" : name});
GLayer.add(graphic);
我创建了一个图形层。图形被添加到图形层。 图形由点和符号组成。 我在图形中创建了一个属性。 怎么得到图形所有属性的key呢? 或者是否可以知道图形属性中特定键的存在与否?
Read the documentation before posting please。这是 graphic.attributes
.
除了阅读文档,您还可以使用 console.log(graphic)
将对象转储到控制台,在那里您可能会发现它有一个 attributes
参数,或者您可以使用调试工具在其中一行设置断点并检查 graphic
对象以查看其所有键。请先尝试做自己的研究和调查。