Adobe Flash Builder don't display a widget in a widget group

4018
13
Jump to solution
11-18-2014 07:30 PM
LiYao
by
Deactivated User

Dear all,

I have 3 widgets in a widget group:

66666666666666666666.jpg

But I only want the first 2 widgets displayed in the widget group. The "Attribute Search Results" widget supposed to be open only when a button in "Attribute Search" is clicked.

I guess it should be set in config.xml, but I don't know how to set it.

I am using Adobe Flash Builder 4.6 and ArcGIS API for flex 3.6.

Thanks in advance.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Li Yao,

   Don't get overwhelmed by all the eSearch widget code. Just focus on the SearchWidgetFloatDG.mxml and just the areas of the eSearchWidget.mxml that display the SearchWidgetFloatDG using the popup manager.

View solution in original post

0 Kudos
13 Replies
AnthonyGiles
Honored Contributor

Li,

I don't think there is anything out of the box that you can place in the config to acheive what you are trying to do.

One option that may work is place the widget in the UI elements of the config so that the widget loads on the application startup, then inside the widgets basewidget_widgetConfigLoaded() or init() functions close the widget using:

this.wTemplate.widgetState = "closed";

I have not fully tested this so not sure if it will have adverse side effects.

Regards

Anthony

LiYao
by
Deactivated User

Hi Anthony,

Thanks a lot for the reply. When I tried to add

this.wTemplate.widgetState = "closed";

into the init() function of the widget, I got an error which indicate

wTemplate is undefined, have I missed something?

Thanks.

0 Kudos
AnthonyGiles
Honored Contributor

Has your widget been built using the standard widget template like the other widgets in the viewer?

0 Kudos
LiYao
by
Deactivated User

Hi Anthony,

I am using "Building Automatically".

Another thing to check is by this option, if the widget is not displayed in the widget group, can it opened by another widget? Since I need to open it by widgetId.

Thanks a lot.

0 Kudos
AnthonyGiles
Honored Contributor

Yes the widget will still be assigned an ID so you can call it from another widget.

I dont think you understood what I meant by how have you have built your widget (I'm not worried about if the project builds automatically or not) what i was wondering was have you taken an existing widget and stripped out the code you didn't need and added your own. You should be able to call this.wTemplate if you are using the widget template.

Also have a look at this article which explains how to migrate from the old viewer to the new but does give a step by step guide on creating a new widget (package):

Migrating Widgets to the ArcGIS Viewer for Flex

0 Kudos
LiYao
by
Deactivated User

Hi Anthony,

Yes I am using standard widget template. I cannot find wTemplate because I changed the widgetTemplate id.

I put the following in config.xml UI elements:

<widget left="10"   top="10" config="widgets/MyService/AttributeSearch/AttributeSearch.xml" url="widgets/MyService/AttributeSearch/AttributeSearch.swf"/>

May I confirm the this.wTemplate.widgetState = "closed" is added in the widget which I want to hide from the group right? I only have init() in the mxml, not basewidget_widgetConfigLoaded() there.

Thanks a lot for the patient.

0 Kudos
AnthonyGiles
Honored Contributor

Li,

Yes you are correct, by default anything that is added as a UI widget will open automatically so what you are trying to achieve is to close the widget straight away (but the widget is still loaded into the application so can be open when required), I tested this by adding the code: this.wTemplate.widgetState = "closed" into the basewidget_widgetConfigLoaded() function, you may not have this as you are probably not using a config xml for your widget so placing it in the init() function should be OK.

I'm not sure why if you have built your widget based on the standard template why you cannot call this.wTemplate.widgetState, have you change the name of the id of the viewer:WidgetTemplate:

<viewer:WidgetTemplate id="wTemplate" ..........>

if you have changed the id you will need to use this.idname.widgetState

Regards

Anthony

0 Kudos
LiYao
by
Deactivated User

Hi Anthony,

I have changed the widgetTemplate id to wTemplate, the surprise thing is the result is opposite to expected.

When load the map service, although the widget not displayed in the widget group, the widget display on map. When I load in another widget, it not appear.

I set wTemplate.widgetState = "closed" in init() should means when other widget load this widget, it widget is closed right?

Thanks you.

0 Kudos
AnthonyGiles
Honored Contributor

Li,

Sorry I don't understand what you mean, the self.wTemplate.widget state needs to sit in the widget that you have placed in the UI area to stop it loading automatically open. You then need the code in the other widget that will reopen that widget when required, which I assumed you had got.

I think if you are just trying to show the results from a search in another widget/window/table then I would suggest having a look at Roberts esearch widget. He has already done all this work for you and has written an supurb guide on how to configure the widget.