Hi all,
I have a flex widget, after click a button the widget will be hidden and another widget will be loaded.
But after that even I click on the widget in the menu, the widget will not appear.
The code for hide the widget is as follows:
query.visible = false
What should I do for enable the visibility of the widget?
I am using arcgis api for flex 3.6.
Thanks a lot!
Solved! Go to Solution.
Li Yao,
So this code should close your widget then:
var widgetId:Number = ViewerContainer.getInstance().widgetManager.getWidgetId("Attribute Search");
AppEvent.dispatch(AppEvent.WIDGET_CLOSE, widgetId);
Do you have these two imports in your widgets code?
import com.esri.viewer.AppEvent;
import com.esri.viewer.ViewerContainer;
Li Yao,
This is how you are suppose to close a widget:
var widgetId:Number = ViewerContainer.getInstance().widgetManager.getWidgetId("Title of Widget");
AppEvent.dispatch(AppEvent.WIDGET_CLOSE, widgetId);
Thank you very much Robert, unfortunately by using getWidgetId, no error but no response.
May I confirm the title of widget refers to the title "Attribute Search" in the below picture?
I try different numbers instead of widgetId, it works, but still want to why getWidgetId not working.
Thanks a lot!
Li Yao,
Can you show me your main config.xml where this widget is listed?
Hi Robert,
The widget group listed in the config.xml is as follows:
<widgetgroup icon="assets/images/WidgetGroup.png" label="Map Services">
<widget label="Turn On/Off Map Service"
icon="assets/images/turnOnOff.png"
config="widgets/MapService/TurnOnOff/TurnOnOff.xml"
url="widgets/MapService/TurnOnOff/TurnOnOff.swf"/>
<widget label="Attribute Search"
icon="assets/images/i_search.png"
config="widgets/MapService/AttributeSearch/AttributeSearch.xml"
url="widgets/MapService/AttributeSearch/AttributeSearch.swf"/>
<widget label="Attribute Search Results"
icon="assets/images/i_search.png"
config="widgets/MapService/AttributeSearchResults/AttributeSearchResults.xml"
url="widgets/MapService/AttributeSearchResults/AttributeSearchResults.swf"/>
</widgetgroup>
Thanks a lot.
Li Yao,
So this code should close your widget then:
var widgetId:Number = ViewerContainer.getInstance().widgetManager.getWidgetId("Attribute Search");
AppEvent.dispatch(AppEvent.WIDGET_CLOSE, widgetId);
Do you have these two imports in your widgets code?
import com.esri.viewer.AppEvent;
import com.esri.viewer.ViewerContainer;
Hi Robert,
I missing importing ViewerContainer, after importing it, it works as expected, thank you so much.