Select to view content in your preferred language

Highlight and show infoTemplate at the same time how please?

1966
11
05-13-2014 06:31 PM
ryannz
by
Deactivated User
Hello everyone, I am new to this ArcGIS api, so please be patient. I am trying to create a search functionality with the popup. Something similar to this post:

http://forums.arcgis.com/threads/95347-InfoTemplate

I downloaded this but the code doesn't work. Not sure why. So here is what I want to achieve. I have set up the map and add featurelayer to the map. I have a search textbox and when I searched, the line is highlighted however, the infotemplate doesn't show up until I clicked on the line. How can I highlight the line and show the infoTemplate popup at the same time when I click on search button (without clicking on the map)?

If you have links that I could refer to, please share with me.

Thanks
0 Kudos
11 Replies
TimWitt
Deactivated User
Ryan,

This might be helpful? Instead of my button you would use your search button.

Tim
0 Kudos
ryannz
by
Deactivated User
Thank you Tim for the reply. I can see the example is very closed to what I am trying to do. But I noticed that the points in the example is plotted by using the exact coordinates

  var attr2 = {"Xcoord":singlePoint2.x,"Ycoord":singlePoint2.y}


You mentioned about using the search button, what should be in the search textbox? Coordinates? Could I pass the ID instead?

I reckon if I could the pass the ID from the search and I also could pass it from my gridview. In my case, I have many lines and the line datakey ID is listed in a gridview. When a user click on a select button in a line of a gridview, I would love to pass the ID and display the popup. The problem is how I can take that ID and display the popup in the right coordinates?

Thanks again.
0 Kudos
TimWitt
Deactivated User
Oh I see, is this what you are trying to do, with the addition of, once a user clicks on the grid you would like to zoom to it and the popup to appear?
0 Kudos
ryannz
by
Deactivated User
Thank you Tim again. Sorry to be pain. The example is very very similar to what I want. But there is no popup? How would you show a popup when you click in the gridview?

Thank you very much.
0 Kudos
JonathanUihlein
Esri Regular Contributor
Hi Ryan.

This might be what you are looking for:
https://developers.arcgis.com/javascript/jshelp/intro_infowindow.html

I strongly recommend checking out the 'Concepts' section of our documentation if you haven't already.

Reading the docs could potentially save you dozens of hours in the long run.
0 Kudos
ryannz
by
Deactivated User
Thank you Jon. Yes that's the popup I need. I have read that document actually and the problem is I need to interact with the map for the popup to appear based on that article. My case is different. The user clicked on a button in the gridview and I would love the popup to appear in the correct coordinate and at the same time the selected featurelayer highlighted.

There is no interaction with the map as far as I can see. Just like the example from Tim, the highlight is working but no popup. I wonder if it is possible to have highlight and popup at the same time without clicking on the map itself.


Have you done anything similar before?

Thanks
0 Kudos
JonathanUihlein
Esri Regular Contributor
I have  read that document actually and the problem is I need to interact with  the map for the popup to appear based on that article.


There's alot more to read! Have you tried creating a point object and setting the infoWindow location?
var point = new Point(x, y, map.spatialReference);
map.infoWindow.show(point);



I wonder if it is possible to have highlight and popup at the same time without clicking on the map itself.


You can 🙂 There are samples that show both behaviors separately.

You, as the developer, would need to combine them to produce your desired functionality.
0 Kudos
ryannz
by
Deactivated User
Yes Jon. Will do more research. So just to confirm, it is possible for the api to show the popup and highlight without clicking on the map itself? Without clicking on the featurelayer is the key to what I am trying to do.

I talked to a developer and he said arcmap api doesn't have this capability and I need to switch to google map api. I hope this is not true. I don't want to change.

Thanks
0 Kudos
JonathanUihlein
Esri Regular Contributor
  So just to confirm, it is possible for the api to show the popup and highlight without clicking on the map itself? Without clicking on the featurelayer is the key to what I am trying to do. 


Absolutely. It would all be done programmatically.
As long as you have the feature data and required geometry, you wouldn't even need a click event handler 🙂

Hypothetical Use Case:
1) You click on a row in your grid (that row represents a single feature)
2) Using IDs, highlight the feature using selectFeatures()
3) Display a custom popup with data about that feature, anywhere you want (perhaps you would show it at the feature's center if its a polygon)

  
I talked to a developer and he said arcmap api doesn't have this capability and I need to switch to google map api.


If you don't mind, could you email me the name of the person you talked to? ( juihlein@esri.com )
Being a fellow developer, I want to make sure we are on the same page 🙂
Thanks!!
0 Kudos