-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi everyone, I need to split my screen into several .zul. I'm using includes to achieve this. However when I try to retrieve the elements inside the includes, through getFellow they are null. All help is good.
Sândalo Bessa
Look at the code:
Window main-------------------------------- <window title="Test" apply="test.Controller"> <include src="testinclude.zul" mode="instant"></include> <button label="Test" onclick="$Controller.test()"></button> </window> Window included--------------------------------
<window title="Teste Include"> <textbox id="teste"></textbox> </window> Controller-------------------------------------
package teste; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.util.GenericForwardComposer; import org.zkoss.zul.Window; @SuppressWarnings("rawtypes") public class Controller extends GenericForwardComposer { /** * */ Window window; private static final long serialVersionUID = 1706388158004585874L; @SuppressWarnings("unchecked") @Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); window = (Window) comp; System.out.println(); } public void test(){ window.getFellowIfAny("test",true);//return null, here } }
Pretty normal you have null there.
Include implements the IDSpace interface, what means that you can have the same id's under the include as under you window.
If you need first fetch your include and then query further.
Or use :
Path.getComponent();
As explained here : https://www.zkoss.org/wiki/ZKDeveloper'sReference/UIComposing/IDSpace
Asked: 2016-11-28 13:17:46 +0800
Seen: 31 times
Last updated: Nov 28 '16