Query, Highlight and Attributes.

613
5
Jump to solution
02-08-2012 12:10 PM
CesarRevilla
New Contributor III
Hello,

1. I use a onMouseMove event to display attributes in a html span.
2. I use a highlight function to show the selected polygon.
3. I use URL Parameters to make a Query or a Find to select a polygon directly.
4. This selected polygon is centered, zoomed and highlighted.
5. The Query Result or the Find Result don't contains attributes.
6. PROBLEM: The onMouseMove event over this highlighted object can't display the attributes of the original Graphic.

There is a solution?

Thanks!
orzundher
0 Kudos
1 Solution

Accepted Solutions
StephenLead
Regular Contributor III
How can I retrieve the attributes in the query/find, to attach them to the new graphic?


In the Query, you can specify outFields, which are the fields which are returned in the query results.

Then you can use graphic.attributes = query.attributes

Cheers,
Steve

View solution in original post

0 Kudos
5 Replies
StephenLead
Regular Contributor III
For 1, do you mean that you're listening to the onMouseMove event on a feature layer or graphic layer?

Ithink the problem is that the graphic highlight which is returned by the query/find draws as the top layer on the map, so the onMouseMove event doesn't react (since the mouse is over the new graphic, rather than the layer underneath.

You could retrieve attributes in the query/find, attach them to the new graphic, and listen to the onMouseMove event on this new graphic.

Is that what you mean?

Cheers,
Steve
0 Kudos
CesarRevilla
New Contributor III
Hi Steve,

right! in this case I can't copy the attributes to the "graphic highlight", and onMouseMove can't get the attributes from the "underneathed graphic".

How can I retrieve the attributes in the query/find, to attach them to the new graphic?

Thankyou,
orzundher
0 Kudos
StephenLead
Regular Contributor III
How can I retrieve the attributes in the query/find, to attach them to the new graphic?


In the Query, you can specify outFields, which are the fields which are returned in the query results.

Then you can use graphic.attributes = query.attributes

Cheers,
Steve
0 Kudos
CesarRevilla
New Contributor III
Thanks a lot! 🙂
0 Kudos
StephenLead
Regular Contributor III
Thanks a lot! 🙂


No problems. Another (simpler) option may be to make a graphic which only has a border (no fill). That way, (I think) the onMouseOver event will continue to fire on the underlying dataset.
0 Kudos