Passing Parameter to Flex Viewer

16786
114
01-14-2011 03:46 AM
CurtNielsen
New Contributor III
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
AnshulMantri1
New Contributor
Thats great..

Robert can u send some link from where i can get some kind of documentation for this kind of configuration.

Thanks for the help..

Warm regards
Anshul

Anshul,

   All the same stuff you have in your Config.xml but make sure the widget that you are wanting to load is set to preload="open".
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Anshul,

    All the Documentation for the Flex Viewer can be found here:

http://help.arcgis.com/en/webapps/flexviewer/index.html
0 Kudos
AnshulMantri1
New Contributor
Thanks
Robert

Now that i m done opening a widget of my own choice, how can i pass few values into it.

In my case on click of html page i fire a URL with first parameter as myWidgetName and the second parameter is a value, now how do i accept this in say any of the field of the opened Widget.

Definitely on init() of this widget i will add add this value to the field. But i want to know HOW can i accept this value from URL ?

Regards
Anshul

Anshul,

    All the Documentation for the Flex Viewer can be found here:

http://help.arcgis.com/en/webapps/flexviewer/index.html
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Anshul,

   OK to do that use this line of code
ViewerContainer.urlConfigParams.yourURLVal


So your url would be something like
index.html?config=config-mywidget.xml&yourURLVal=hello


The viewer is programmed to decode and store url parameters in the urlConfigParams object.
0 Kudos
AnshulMantri1
New Contributor
Do i have to add this
ViewerContainer.urlConfigParams.yourURLVal

in the init function of my Widget..?

or can u give a simple eg for say my URL is
index.html?config=config-mywidget.xml&yourURLVal=hello


in above case how will i get value for this yourURLVal inside my widget init() function ?


Anshul,

   OK to do that use this line of code
ViewerContainer.urlConfigParams.yourURLVal


So your url would be something like
index.html?config=config-mywidget.xml&yourURLVal=hello


The viewer is programmed to decode and store url parameters in the urlConfigParams object.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Anshul,

  I thought that it was obvious that yes you would call ViewerContainer.urlConfigParams.yourURLVal from your widgets init function.
0 Kudos
AnshulMantri1
New Contributor
What i have done is declared a blank variable in my WidgetConfig as below
<myVar></myVar>

Then on init() i accept the value and assign it to a string.
Bind this value onto a text field.

and my url will be index.html?config=config-myWidget.xml&myVar=123

Is this the rite way...?

Anshul,

  I thought that it was obvious that yes you would call ViewerContainer.urlConfigParams.yourURLVal from your widgets init function.
0 Kudos
AnshulMantri1
New Contributor
Thanks a lot Robert finally i achieved it by ViewerContainer.urlConfigParams.yourURLVal... 🙂

Thanks for u r support
Regards
Anshul

What i have done is declared a blank variable in my WidgetConfig as below
<myVar></myVar>

Then on init() i accept the value and assign it to a string.
Bind this value onto a text field.

and my url will be index.html?config=config-myWidget.xml&myVar=123

Is this the rite way...?
0 Kudos
JosieBock1
New Contributor III
Hopefully someone can help me with the whole passing a parameter to a flex viewer. I've been pouring over the forums and codes that people have posted regarding such and issue, and I've gotten my code to compile without errors. However, when I enter the query parameters my site doesn't perform the search. It just pulls up to it's normal extent with nothing selected. If someone has some time to help me troubleshoot my problem I would greatly appreciate it.

I am attaching some of the code pages for reference. The url that I use for testing is: http://gis-server.greatriv.com/christiancoflex2/index.html?q=DataViewer!70*v=110515000000007000

Again, I would be grateful for any help with this.

JB
0 Kudos
JosieBock1
New Contributor III
Disregard this post. I figured out what I did wrong.

Hopefully someone can help me with the whole passing a parameter to a flex viewer. I've been pouring over the forums and codes that people have posted regarding such and issue, and I've gotten my code to compile without errors. However, when I enter the query parameters my site doesn't perform the search. It just pulls up to it's normal extent with nothing selected. If someone has some time to help me troubleshoot my problem I would greatly appreciate it.

I am attaching some of the code pages for reference. The url that I use for testing is: http://gis-server.greatriv.com/christiancoflex2/index.html?q=DataViewer!70*v=110515000000007000

Again, I would be grateful for any help with this.

JB
0 Kudos