Select to view content in your preferred language

Widget Container

1683
4
08-16-2011 08:49 AM
FaizanTayyab
Deactivated User
This may be very basic but I have few problems when i try to load the widgets. I want to load all the widgets vertically and have them in minimized state by default. At the moment i do get them lined up vertically but initially they are in open state and then get minimized. This is visible to the user and doesnt look good.

Secondly I want to restrict the scroll of the widgets when all widgets are in view/screen. This is either not working for me or i am missing some setting.

Finally how can i move the widget container controller to start the first widget from specific location.

Can anyone please help.
Tags (2)
0 Kudos
4 Replies
BjornSvensson
Esri Alum
Finally how can i move the widget container controller to start the first widget from specific location.


You can set top and bottom properties on the widget container.
http://help.arcgis.com/en/webapps/flexviewer/help/index.html#/The_Widget_Container_tag/01m3000000030...
0 Kudos
FaizanTayyab
Deactivated User
I was able to move the widget container scroll controls up by changing the y in the BorderContainer in WidgetContainer.mxml.

However as per my requirements i require the widgets "not scroll out of screen/stage if all widgets do fit well on the stage" and this is not happening.

Secondly i have removed the HeaderController and want my widgets to be minimized and arranged vertically. I do get them arranged vertically but they seemed to be pushed up out of the stage once the widgets are minimized. Is there any way to stop the widgets from going out of view on minimizing. I have set the widget container top and right and also of individual widgets but that's not fixing the problem. Is this a bug.

I think the isValidScroll function in the WidgetContainer.mxml is not working properly.

Has anybody got this to work?

Just found out that if the browser window is maximized, it seems to work fine however when the browser window is resized, the widgets get pushed upward out of browser screen.
0 Kudos
FaizanTayyab
Deactivated User
Is it possible to add components to the Widget Container. One solution to the problem "I want to load all the widgets vertically and have them in minimized state by default. At the moment i do get them lined up vertically but initially they are in open state and then get minimized", could be to add dummy widgets in the container in minimized state initially and then replace them with the original widgets. However this is becoming a bit difficult with the Widget Manager and Widget Container.

Is there any easier way to have the widgets minimized intially when the map loads.
0 Kudos
FaizanTayyab
Deactivated User
Thought, this might help someone who is looking for something similar.

1. Create Dummy Widget using Border container

2. In WidgetContainer
private function removeDummy(event:AppEvent):void
   {
    var widget:IVisualElement;
    var data:Object = event.data;
    curId = data.id as Number;
    for (var i:int = 0; i < widgetContainer.numElements; i++)
    {
     widget = widgetContainer.getElementAt(i);
     
     var baseWidget:InitMinWidget = widget as InitMinWidget;
     if(baseWidget!=null){
      if (baseWidget.myId == curId)
      {
       widgetContainer.removeElement(baseWidget);
      }
     }
    }
    
   }
public function addMinElement(element:IVisualElement):IVisualElement{
    if (element as SkinnableContainer){
     // Added by FT to add the element in widget Container group
     if(element!=null)
      this.widgetContainer.addElement(element);
    }
    return element;
   }
 private function addWidget(element:IVisualElement):void
            {
                var baseWidget:IBaseWidget = element as IBaseWidget;
                baseWidget.isDraggable = this.isDraggable;
                constrainWidget(baseWidget);
                //widgetContainer.addElement(element);
    widgetContainer.addElementAt(element,Number(baseWidget.widgetId));
            }


3. In Widget Manager
private function preloadNextWidget():void
            {
                if (preloadArray.length > 0)
                {
                    var id:Number = preloadArray[0].id;
                    preloadArray.splice(0, 1);
                    //AppEvent.dispatch(AppEvent.WIDGET_RUN, id);
     var preload:String = configData.widgets[id].preload;
     var label:String = configData.widgets[id].label;
     var icon:String = configData.widgets[id].icon;
     var config:String = configData.widgets[id].config;
     var url:String = configData.widgets[id].url;
     var preWidget:InitMinWidget = new InitMinWidget();
     preWidget.myId = id
     preWidget.myLabel = label;
     preWidget.myIcon = icon;
     
     var wgtContainer:IWidgetContainer = configData.widgetContainers[0].container.obj;
     
     wgtContainer.addMinWidget(preWidget);
     preInitWidgetArr.push(preWidget);
                }
            }
0 Kudos