Select to view content in your preferred language

Flex widget visible set to false, after that cannot visible again

2492
6
Jump to solution
11-17-2014 11:50 PM
LiYao
by
Deactivated User

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!

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

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;

View solution in original post

0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Emeritus

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);

0 Kudos
LiYao
by
Deactivated User

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?

3333333333.jpg

I try different numbers instead of widgetId, it works, but still want to why getWidgetId not working.

Thanks a lot!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Li Yao,

   Can you show me your main config.xml where this widget is listed?

0 Kudos
LiYao
by
Deactivated User

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.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

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;

0 Kudos
LiYao
by
Deactivated User

Hi Robert,

I missing importing ViewerContainer, after importing it, it works as expected, thank you so much.

0 Kudos