Open a Widget with minimized UI on app start (Widget Manager)

3782
4
Jump to solution
07-30-2015 01:39 AM
StefanP__Jung
Occasional Contributor

I have a in-panel widget which should be (open) minimized when the app starts.

Using the property 'openAtStart: true' is working fine to open the widget when the app starts, but the widget is starting with maximized UI. When using the widget on a mobile device the Panel will use the complete screen.

Is there any property i missed to open the widget with minimized UI at start?

What i've tried is to use the Widget Manager to minimize the widget after it has been initialized. But i've never get it work to minimize any widget, not event the startard widgets (Legend, Layer-List).

GetAllWidgets works like expected and returns the loaded widgets. But if i try to minimize with the widget instance or the id nothing happens:

var wm = WidgetManager.getInstance();
var widgetList = wm.getAllWidgets();

wm.minimizeWidget(widgetList [8])
wm.minimizeWidget(widgetList [8].id)

Any hint is welcome
- Stefan

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Stefan,

  If you are talking about a widget that is added to the HeaderController widget and has the minimize capability then these two lines will work:

var panel = PanelManager.getInstance().getPanelById(this.id + '_panel');
panel.onTitleClick();

Assuming that you are calling this from inside the widget you are trying to minimize.

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Emeritus

Stefan,

  If you are talking about a widget that is added to the HeaderController widget and has the minimize capability then these two lines will work:

var panel = PanelManager.getInstance().getPanelById(this.id + '_panel');
panel.onTitleClick();

Assuming that you are calling this from inside the widget you are trying to minimize.

StefanP__Jung
Occasional Contributor

Hi Robert,

the custom widget i want to minimize is located in the HeaderController, thats correct. I am will try to use the PanelManager tomorrow when I am back in the office. Thank you for this hint.

I also tried to minimize other in-panel widgets which are not located in the HeaderController. But using the Widget Manager did never work for me. Did you ever get it work with the Widget Manager at all? Using the PanelManger and simulate the TitleClick event looks like a workaround for me, but I am happy if it works

- Stefan

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Stefan,

   The HeaderController widget places widgets in a custom panel called a foldable panel. So when the widget is added to this panel technically it does not have a minimized state. The only thing you can do is fold the panel.

0 Kudos
StefanP__Jung
Occasional Contributor

Hi Robert,

theoretical this works fine, but I have some timing problems.

First of all i had a look at the documentation 'Communication to app container' and the 'Dijit Lifecycle' to find out which is the correct method to place the code for minimizing the widget with the PanelManager.

I placed the code in the 'startup' method and it did work with Firefox but not with Internet Explorer.

To make it work in the Internet Explorer i had to use a timeout:

var panel = PanelManager.getInstance().getPanelById(this.id + '_panel');
setTimeout(function() {
panel.onTitleClick();
},500);

Using a timout is not the best solution

I've tested the widget on some mobile devices and the "openAtStart" does not trigger the widget to open at start at all. So i guess for responsive design it does not open cause the display is too small. At the beginning i was only previewing it in the Web AppBuilder and there is a different behavior - as described above.

- Stefan

0 Kudos