I’m using the esri/InfoTemplate in the Javascript API to identify features. However, it gets anchored to the mouse click and cannot be moved around.
Based on this answer I used dojo/dnd/Moveable to make it moveable.
However, now I cannot highlight or copy the attributes inside of it. It’s like Moveable turns it into a graphic or something.
Is there a way to make the InfoTemplate floating but still be able to highlight and copy the attributes?
Thanks in advance for your help.
(The other option I’m considering is using the jQuery Dialog Widget, but I cannot get it to highlight the geometry for multiple features. Any suggestions there would be great too. Whichever is easier.)
Best Answer
I really appreciate all the suggestions, but I never got the esri/dijit/Popup to be moveable and still be able to highlight and copy the text inside. Instead I used a jQuery Dialog, which I figured would be the case but it just took a while to get all the experience needed to make it work the way I wanted it to.
My boss and I both worked on it and we still don't fully understand everything happening. But it works and that's all that matters to us.
Here’s what it looks like with jQuery theme “smoothness”.
Here is the basic sum up:
Since the inner content of a jQuery Dialog needs to be a div, I had to make an array of div elements with the identified attributes as the innerHTML.
When the map is clicked, the code cycles through the visible features. (I can’t remember where I got that from but it looks a lot like this http://jsfiddle.net/blordcastillo/mULcz/)
As it’s cycling through, a div is created for the attributes of each feature and the div is given a custom geometry attribute which is set to the geometry of the feature.
“Previous” and “next” buttons cycle through the array of divs and fires a function to draw the geometry on the map.
Using the geometry attribute of each div, a "Zoom to" button is added for zooming to the feature.
Basically, it acts the same as the Popup and InfoTemplate from the esri api, but now it is moveable around the screen and I can still interact with the text (highlight and copy).
Below is a copy of my module (cut down for size).
Feel free to either use it or “fork” it and let me know how to make it better. Hopefully it helps others.
Thanks again to everybody for all the suggestions!