Select to view content in your preferred language

Passing Parameter to Flex Viewer

24156
114
01-14-2011 03:46 AM
CurtNielsen
Occasional Contributor
I would like to pass a parameter, parcel id, to flex viewer and have the map pan to that location. I have modified the Search widget to use a layer that we can search by parcel ID. Just want the same capability if I pass a parameter, paracle ID, to http://mynode/FlexViewer. Maybe something like http://mynode/FlexViewer?request=widget&version=2.1&WidgetName=Search&ParcelID=1234

Thank you!
Tags (2)
0 Kudos
114 Replies
MarcWeinshenker1
Regular Contributor
Marc,
are there any changes to this code for it to be 2.3.x compatible?


I have not moved to 2.3.x, but I just took a look at it and found that the function where the code gets inserted no longer exists.  That may be the end of it.  You might try Robert's eSearch widget solution.

Marc
0 Kudos
MarcWeinshenker1
Regular Contributor
mark, i dont see the attached txt file.
love to have give it a try.


Glenn,

The txt file is in message #9 of this thread.  I just checked it and it opened fine.  But if you are using Flex Viewer version 2.3.x, then it won't work anyway and you'll be better off trying Robert's eSearch widget solution.

Marc
0 Kudos
MarcWeinshenker1
Regular Contributor


   I made this ability pretty easy (well documented), and very configurable in the eSearch widget. Have you looked at it?


Robert,

I just took a look at your latest eSearch 2.3.2 documentation, specifically the PDF about configuring the URL Search, and found that you also used the mapLoadComplete function in MapManager.mxml.  But that function no longer exists in Flex Viewer 2.3.1.   That's the same function I replaced for the solution I used.  What are your thoughts on this?  [edit -- never mind -- I see that your URL Search function is only for Flex Viewer 2.2.  So, what next?]

Thanks,
Marc
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Marc,

   Actually it works fine in Flex Viewer 2.3.1 also. Even though esri removed the mapLoadComplete function I have you add it back and use it for my purposes instead.
0 Kudos
MarcWeinshenker1
Regular Contributor
Marc,

   Actually it works fine in Flex Viewer 2.3.1 also. Event know esri removed the mapLoadComplete function I have you add it back and use it for my purposes instead.


Robert,

Thanks.  So, if you put the function back in, where do you call it from?  Do you restore the map.AddEventListener line in the protected override function partAdded where it was before?  If it's this simple, then maybe the solution I was using will still work as well.

Marc
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Marc,

   It will work just fine. So you can go back to your function.
0 Kudos
MarcWeinshenker1
Regular Contributor
Marc,

   It will work just fine. So you can go back to your function.


Thanks, Robert.  I'll give it a try.

Marc
0 Kudos
NathanEnge
Esri Contributor
Marc, I just tested it and it works.



protected override function partAdded(partName:String, instance:Object):void



{
   map.logoVisible = 
false; 
   super.partAdded(partName, instance);
   if (instance == map)
   {
       var cssStyleDeclaration:CSSStyleDeclaration = styleManager.getStyleDeclaration  ("com.esri.ags.components.supportClasses.InfoWindow")
       cssStyleDeclaration.setStyle("backgroundColor", getStyle('contentBackgroundColor'));
       styleManager.setStyleDeclaration("com.esri.ags.components.supportClasses.InfoWindow", cssStyleDeclaration, true);
       map.addEventListener(MapEvent.LOAD, mapLoadComplete);
       changeESRILogo(map);
   }


}


And then your mapLoadComplete function, I just placed inbetween these two functions:
override
protected function getCurrentSkinState():String
and the
private function changeNavigationbyWidget(event:AppEvent):void
0 Kudos
MarcWeinshenker1
Regular Contributor
Marc, I just tested it and it works.


Excellent!  Thanks for testing it out.

Marc
0 Kudos
ScottSnider
Occasional Contributor
Another rookie question about this topic!

I've made the changes to MapManager as mentioned and I can successfully search with what appears to be the bounding coordinates as given with an example with the code change.  I don't know if I missed this somewhere, but what changes would I need to make to be able to search on an X,Y instead of bounding coords?

The application is for a utility billing software we use, we push centroids of the parcel with x,y to the database for the utility billing.  We have then added a button that will pass a query string to pull up a web map of the location.  Alternatively we could use the other examples of passing a parcel ID, but if there are parcel changes (we do not maintain the parcels) then we would not get a result.  By passing x,y we are guaranteeing that the map will at least zoom to where the parcel used to be.

Thanks,
Scott
0 Kudos