closing all widgets

661
2
05-20-2011 03:43 PM
JohnGarvey
New Contributor
I have added a close all button to flexviewer. So far, I can close all the widget, but the widget boxes remain on the screen even though they are empty.

Mu approach has been to create an AppEvent to close all and have the widget manager
1:catch the event, 2:iterate the widget table; 3:simulate the close button's click event on the template and 4:set the widget state to "closed"

Maybe I am going the wrong way, any suggestions?
Tags (2)
0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus
John,

   Are you dispatching this event?

var data:Object =
            {
                id: yourwidgetsid,
                state: WIDGET_CLOSED
            };
        ViewerContainer.dispatchEvent(new AppEvent(AppEvent.WIDGET_STATE_CHANGED, data));
0 Kudos
JohnGarvey
New Contributor
Yeah. The widget dispatches an AppEvent to clear all. The widget manager then

var widgetsArr:Array=widgetTable.toArray();
    var len:uint=widgetsArr.length;
    for(var i:uint=0;i<len;i++){
     
     var data:Object =
      {
       id: widgetsArr.widgetId,
       state: WIDGET_CLOSED
      };
     ViewerContainer.dispatchEvent(new AppEvent(AppEvent.WIDGET_STATE_CHANGED, data));
    }


This doesn't seem to work
0 Kudos