Panel default size

8425
12
Jump to solution
04-21-2015 01:41 AM
eduAED
by
New Contributor II

How can I configure the default size of a Panel?

I want to start a widget within a small panel.

Thanks!

0 Kudos
12 Replies
MichaelGaigg
Esri Contributor

First one must get the instance of the PanelManager. What worked for me was

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

      pm.resize({h:720});

RyanCoodey
Occasional Contributor III

Thanks for the example. This works for me except on initial load of the widget. Tried it in postCreate, startup, onOpen... based on the lifecycle of a widget docs, onOpen is the last to be called so currently have it there. Opening the first time the widget size does not resize but after closing and reopening then the resize does work each time thereafter.

It seems to be a timing issue because if I put a breakpoint on this line then let it continue, it works on initial load too. Also, if I add a setTimeout for like 1 second it works.  Anyone know if there is an event to subscribe to for whatever else needs to happen first?

BTW, I am doing this in a Portal 10.8.1 web app custom widget, not stand alone WAB.

0 Kudos
B-L
by
New Contributor III

Hi @RyanCoodey ,

 

I know this is an old thread but I ran into the same issue and found a solution on this page https://support.esri.com/en/technical-article/000025937 .  I was missing.... 

      panel.setPosition(panel.position);        
      panel.panelManager.normalizePanel(panel);   


     The full code of what worked for me is: 
 
       

 

var pm = PanelManager.getInstance();
var panelID = pm.activePanel.id;
var activePanel = pm.getPanelById(panelID);
activePanel.position.width = 669;
activePanel.setPosition(activePanel.position);
activePanel.panelManager.normalizePanel(activePanel);

 





 

 

0 Kudos