Open Widget with Button from within another Widget?

1468
5
12-06-2011 06:36 AM
PaulMcBride
New Contributor III
i have a parcel search widget that within the results I would like to click the button and have it pull up my print widget so that it eliminates a step that the public will have to do.  Any thoughts?

Thanks!
Tags (2)
0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus
Paul,

   Just call this from your button click event:

AppEvent.dispatch(AppEvent.WIDGET_RUN,ViewerContainer.getInstance().widgetManager.getWidgetId("yourPrintWidget"));


of course you will need these imports in your widget if you don't have them already:

import com.esri.viewer.AppEvent;
            import com.esri.viewer.ViewerContainer;
by Anonymous User
Not applicable

Hey Robert!

Running into a slightly more obtuse situation that I haven't been able to solve with either your solution or DOM calls.

I'm using the 'About' Widget and, within the widget's content-pane I have create buttons using <div> elements. I was hoping that a user would be able to click on a button from the panel and the widget launches -- unfortunately, since I'm basically editing the innerHTML of an element, I was able to get your solution working. 

I then looked into some document.getElementBy... operations but it appears that div classes in WAB use settingid, not id and the classes change depending on whether the element is in focus, so I wasn't able to push a nested JS function that would simulate clicking the appropriate widget's icon.

Any ideas on how I could open a widget using an html button within the About widget?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Andrew,

   You are posting in the Obsolete Flex Viewer forum. It would be best for you to search the WAB forums for launching a widget from another widget.

0 Kudos
by Anonymous User
Not applicable

Didn't even realize they still had these old flex forums up! 

Will do and good call!

0 Kudos
PaulMcBride
New Contributor III
Robert,

Thank your for the continued help!
0 Kudos