-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Is there a way to resolve view model properties as input to client side javascripts?
In the example shown below, the "????" indicates the bit that I have a problem with. The my.zul fragment shows a listbox where the attribute "w:onSelect" defines a client side event which is trigged when an entry in the listbox is selected:
my.zul fragment::
<window id="reportPanelWindow"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('com.alpha.pineapple.web.zk.viewmodel.ModulePanel')"
hflex="1" vflex="1" border="none" >
... layout stuff here....
<listbox id="modelListbox"
model="@load(vm.models)"
selectedItem="@bind(vm.selectedModel)"
onSelect="@command('loadSelectedModel')"
w:onSelect="helloJS( ????? )"
I would like the event to invoke a JavaScript defined in the zul named "helloJS" to which I need to provide input from the view model as argument.
The two possible solutions that I hope for help with is either:
1) Resolution of view model properties (e.g. vm.xxxx) as input to a java script. As stated above the missing part is illustrated with the ???? in the example above.
2) Access to view model properties from within a java script defined in a ZUL, e.g. can I access the view model vm from the helloJS script?
BR, Allan
could be like this,
< button label="test" w:param="@load(vm.someval)" w:onClick='alert(this.param)'/>
however, it doesn't provide yet.
You may use ZK-Angular Project instead.
You can use client binding API to do so, please take a look at this article
Asked: 2012-12-21 10:50:17 +0800
Seen: 106 times
Last updated: Mar 26 '15
zul.mesh.wpd this.$n().style is null
Facing issue in masking on phone [closed]
Execute Javascript on component visible
how to save ms-word docx file using edraw in zk
How to update ZK Grid values from jQuery
How can I use a newer version of jQuery?
How to send Base64 encoded data using JavaScript to server-side
How to print a popup window without printing the parent window