0

ZK7 retrieve Include query param in viewModel ?

asked 2015-07-09 13:36:37 +0800

WilliamB gravatar image WilliamB
1609 1 6

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

delete flag offensive retag edit

Comments

ExecutionArgParam already tried?

chillworld ( 2015-07-09 13:39:31 +0800 )edit

Nop no dice

WilliamB ( 2015-07-09 14:37:14 +0800 )edit

If 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

3 Answers

Sort by ยป oldest newest most voted
0

answered 2015-07-09 14:46:37 +0800

Darksu gravatar image Darksu
1991 1 4

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

link publish delete flag offensive edit

Comments

Hello Darksu,

Yeap I know about ExecutionArgParamand include, but for this particular param i wanted it to go through the url in src as a mean to refresh the included page with the new parameters.

WilliamB ( 2015-07-09 15:50:24 +0800 )edit
0

answered 2015-07-09 16:58:52 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

updated 2015-07-10 06:37:47 +0800

First thing:

<include mode="defer" ...

Second thing :

Executions.getCurrent().getParameter("param");

or work with :

public void init(@QueryParam("param") String param)

Fiddle is here.

This should work.

Greetz chill

link publish delete flag offensive edit

Comments

Can't get it to work. Defer crash the loading

WilliamB ( 2015-08-17 14:37:48 +0800 )edit

Can you give the exception?

chillworld ( 2015-08-17 17:11:07 +0800 )edit
0

answered 2015-08-18 09:43:45 +0800

WilliamB gravatar image WilliamB
1609 1 6

updated 2015-08-18 12:14:57 +0800

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')">
link publish delete flag offensive edit

Comments

can you post mineInclude.zul? the problem lies there on line 4

chillworld ( 2015-08-18 10:06:26 +0800 )edit

It's the VM ref, see EDIT in the prev message.

WilliamB ( 2015-08-18 12:15:42 +0800 )edit

possible to reproduce it in a fiddle or send me a small example of it?

chillworld ( 2015-08-18 14:05:37 +0800 )edit

Remade a small zk webapp and can't reproduce the issue on it ...

WilliamB ( 2015-08-21 12:43:09 +0800 )edit

Try removing viewmodel and apply setting and see if it work line that.

chillworld ( 2015-08-21 13:20:37 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2015-07-09 13:36:37 +0800

Seen: 71 times

Last updated: Aug 18 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More