Select to view content in your preferred language

Search Widget: Can I reset it after HeaderController icon clicked again?

625
4
Jump to solution
08-09-2012 08:38 AM
BlaiseMacLean
New Contributor III
In my config.xml the Search widget is set to - preload="open"

If the user enters some criteria and gets a match then it switches to the State = resultsList.

If the user clicks the search icon up in the Header control is there an event that gets fired in the Search widget?

I'd like to switch back to "textInput" mode and clear the text box so they're ready to do another search.

Thanks,

Blaise
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Blaise,

   No there is not an event that gets fired if the widget is already opened. In the WidgetItemDataGroupRenderer.mxml of the HeaderControllerWidget, the itemrenderer_clickHandler checks if the widget is open and if it is then it does not fire the WIDGET_ITEM_CLICK event.

View solution in original post

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus
Blaise,

   Sure in the SearchWidget.mxml you will find a function called widgetOpenedHandler this function gets called each time the widget get displayed. So that you be a great place to add some code like:

this.currentState = "textInput";
txtSearch.text = "";


Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow the steps as shown in the below graphic:
0 Kudos
BlaiseMacLean
New Contributor III
Thanks again Robert, you've helped me a lot over the past week or so.

This works perfectly when the widget is closed and the icon is clicked to re-open it.

But it looks like the event isn't fired when the widget is already loaded.  Is there another event that might work??
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Blaise,

   No there is not an event that gets fired if the widget is already opened. In the WidgetItemDataGroupRenderer.mxml of the HeaderControllerWidget, the itemrenderer_clickHandler checks if the widget is open and if it is then it does not fire the WIDGET_ITEM_CLICK event.
0 Kudos
BlaiseMacLean
New Contributor III
Okay.

As a work around I added a Clear button to the resultsList statte.  It clears the search textbox and goes back to the textInput state.  I was just trying to make sure an inexperienced user can find their way back to the textInput.

Thanks again for your help Robert.

Blaise
0 Kudos