Use dynamic name for fullfill buton

asked 2020-06-22 21:30:17 +0800

rmalik gravatar image rmalik

updated 2020-06-23 12:32:50 +0800

cor3000 gravatar image cor3000
5250 2 7
ZK Team

Hi all,

We have several tabs in our application with button id's. These button id's are used to used on click to fullfill specific divs.

Here a example for the tab:

<h:li><h:a id="button_packingslip" href="#tab_packingslips"  data toggle="tab">${labels.packingslips}</h:a></h:li>

And here a example for the div:

<h:div class="tab-pane" id="tab_packingslips"
       fullfill="button_packingslip.onClick" >
<include src="/secure/packing/overviewPackingslip.zul"
         templateName="short" />

As you can see the button is named "button_packingslip". The problem is that this overview get opened multiple times, which causes the message id is not unique.

Is it possible to generate a GUID in Java and use it in the fullfill dynamically?

Like for example :

<h:div class="tab-pane" id="tab_packingslips" fullfill="${vm.getTabName('button_packingslip').onClick" >

<include src="/secure/packing/overviewPackingslip.zul" ordernr="${vm.selected.field('OrderNr')}" templatename="short"/> </h:div>

I tried the above approach but it seems the method getTabName() is not to be activated while debugging.

Kind regards,


delete flag offensive retag edit

3 Answers

Sort by » oldest newest most voted

answered 2020-06-23 12:45:28 +0800

cor3000 gravatar image cor3000
5250 2 7
ZK Team

I think fulfill is quite limited and is not really useful for an MVVM scenario where you would want to have the view state represented in your ViewModel.

I am not fully clear what you are trying to achieve, which "overview" gets opened multiple times. Can you provide a runnable example illustrating this, e.g. on https://zkfiddle.org/ (I'll increase your karma so you can post links).

Also please state whether you are using ZK CE/PE or EE - to focus on the features available in your edition.

link publish delete flag offensive edit

answered 2020-06-23 17:31:43 +0800

rmalik gravatar image rmalik

Thanks for you reply. I am using the ZK 8.5 Community Edition.

I kind of thought about that. The stange thing is that if i use **${vm.packslipButton}.onClick** it does trigger the java method getPackslipButton. I can use and work around with that. The downside of this is, that for every id on a button i should create a java method. The nicest would be a single java method with parameters.

For further references i created this fiddle: link example

In this example i am trying to open the same window. In my example for some reason it is not opening, but i think you will get the idea. The id of the button is not unique error message would apprear, if it was working. I was looking for placing a new GUID in the id and solving the problem of uniqueness.

As you said earlier the on fullfill is not build for MVVM methods.

Any advice is appreciated.

link publish delete flag offensive edit


your example seems incomplete, it's something in between MVVM an MVC ... not sure at all what you are aiming at

cor3000 ( 2020-06-23 17:50:40 +0800 )edit

answered 2020-06-23 18:15:57 +0800

cor3000 gravatar image cor3000
5250 2 7
ZK Team

updated 2020-06-23 18:17:28 +0800

in MVVM command handlers can have parameters:


public void openSomething(@BindingParam("myparam") String myparam) {
  //do something with myparam

invoked from a command binding

<button onClick="@command('openSomething', myparam='myParamValue')"/>

Like that you can use the same command method with multiple parameters

also notice... the button doesn't need any ID for this to work.

link publish delete flag offensive 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

1 follower



Asked: 2020-06-22 21:30:17 +0800

Seen: 7 times

Last updated: Jun 23

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