-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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"
orderNr="${vm.selected.field('OrderNr')}"
templateName="short" />
</h:div>
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,
Remie
in MVVM command handlers can have parameters:
e.g.:
@Command
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.
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.
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.
Asked: 2020-06-22 21:30:17 +0800
Seen: 9 times
Last updated: Jun 23 '20