cancel
Showing results for 
Search instead for 
Did you mean: 

Cockpit NG: How to set the height of a Widget Template?

Former Member
0 Kudos

Hi folks,

this is likely an easy question. But nevertheless, my Widget Template always opens with the size 600px x 400px. And I don't know how to change the height.

Best regards, Clemens

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can set the size also in the view.zul file:

 <widget xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.zkoss.org/2005/zul">
     <style src="${wr}/default.css"/>
     <div style="height:400px;">
 ....
     </div>
 </widget>

Answers (1)

Answers (1)

Former Member
0 Kudos

I found a solution. But obviously not a smart one.

 @Override
 public void initialize(final Component comp) {
     super.initialize(comp);
 
     Window window = findAncestorWindow(comp);
     if (window != null) {
         window.setHeight("700px");
     }
 }
 private static Window findAncestorWindow(Component component) {
     Component current = component;
     while (current != null && !(current instanceof Window) && !(current instanceof Widget)) {
         current = current.getParent();
     }
     return current instanceof Window ? (Window) current : null;
 }