-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hey there,
Using ZK7, I've a main page index.zul in thise page I've an include on which src i want to add sometime a query param
<include src="include.zul">
or
<include src="include.zul?myparam=0">
The value of src is managed by indexViewModel.
How should i proceed in includeViewModel to retrieve the value of myparam ? I've tried several of the annoation in the init method @BindingParam, @QueryParam, @ExecutionParam but none seems to work.
Thanks
Hello WilliamB,
Have you checked out the following documentation?
http://books.zkoss.org/wiki/ZKDeveloper'sReference/MVVM/Advanced/PassArgumentstoIncludeComponent
And an example:
http://zkfiddle.org/sample/17kiil/2-Pass-Parameters-to-included-ViewModel#source-1
Best Regards,
Darksu
First thing:
<include mode="defer" ...
Second thing :
Executions.getCurrent().getParameter("param");
or work with :
public void init(@QueryParam("param") String param)
This should work.
Greetz chill
Hey Chill, not enough room in comment. So I have nothing in my eclipse log, but an error message where my include zul should be displaying :
Failed to load /zul/myInclude.zul
Cause: at [file:/MyPath/mywebapp/zul/myInclude.zul, line:4]
org.zkoss.zk.ui.UiException: at [file:/C:/MyPath/mywebapp/zul/myInclude.zul, line:4]
at org.zkoss.bind.impl.MiscUtil.mergeExceptionInfo(MiscUtil.java:175)
at org.zkoss.bind.BindComposer.doBeforeComposeChildren(BindComposer.java:161)
at org.zkoss.zk.ui.impl.UiEngineImpl.doBeforeComposeChildren(UiEngineImpl.java:930)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:869)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:826)
...
As you see, there isn't a whole lot of information. I'm using ZK 7.0.6
In my main zul the include is like that:
<include mode="defer" param1="@load(vm.param1)" src="@load(vm.includeUrl)" vflex="1" param2="${arg.param2}" param3="${vm.param3}"/>
As you see I've to pass multiple params to the include and although it work, I'd rather pass a couple of them through query param in the includeUrl. Because sometime there are issue with param not updated before loading the subViewModel.
Thanks for your help.
EDIT: Line 4 of Myinclude.zul is the reference to the VM
<window apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('viewmodel.myIncludeViewModel')">
can you post mineInclude.zul? the problem lies there on line 4
chillworld ( 2015-08-18 10:06:26 +0800 )editpossible to reproduce it in a fiddle or send me a small example of it?
chillworld ( 2015-08-18 14:05:37 +0800 )editTry removing viewmodel and apply setting and see if it work line that.
chillworld ( 2015-08-21 13:20:37 +0800 )editAsked: 2015-07-09 13:36:37 +0800
Seen: 71 times
Last updated: Aug 18 '15
ExecutionArgParam already tried?
chillworld ( 2015-07-09 13:39:31 +0800 )editNop no dice
WilliamB ( 2015-07-09 14:37:14 +0800 )editIf i notify (@load) change on a ExecutionArgParam it wont update in the include, the include is only invalidated when src changes.
Regards
WilliamB ( 2015-07-09 15:50:42 +0800 )edit