-
FEATURED COMPONENTS
First time here? Check out the FAQ!
My goal is to have a XHTML button, which would first invoke onClick widget event listener and then invoke a command on the server (I need this to implement a custom confirmation dialog in clientside).
In ZKFiddle the following snippet works perfectly (first I get a client alert and then the command is invoked):
<zk xmlns="xhtml" xmlns:w="client" xmlns:xh="xhtml" xmlns:zk="zk">
<xh:div apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('pkg$.TestVm')">
<xh:button onClick='@command("com")' w:onClick='alert("client alert");'>Click me</xh:button>
</xh:div>
</zk>
However in a ZUL file like this, the command gets called fine, but no clientside alert is displayed.
<?page complete="true" ?>
<!DOCTYPE html>
<html xmlns="xhtml" xmlns:w="client" xmlns:xh="xhtml" xmlns:zk="zk" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd">
<head>
<meta charset="utf-8" />
<xh:zkhead />
</head>
<body>
<div apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('com.company.TestVm')">
<xh:button id="xhbutton" onClick="@command('com')" w:onClick="alert('I\'m ignored :( )')">XHButton</xh:button>
</div>
</body>
</html>
button.getWidgetListener("onClick") does return the value from ZUL, however if I view the source of the page in question, there is only the following javascript: [1,'xhbutton',{id:'xhbutton',$onClick:true},[
Any ideas how to get this to work?
Note: I am aware of the "zk" namespace (as in here: http://books.zkoss.org/wiki/ZK_Developer%27s_Guide/Fundamental_ZK/ZK_User_Interface_Markup_Language/Component_Sets_and_XML_Namespaces/Mix_With_Another_Markup_Language (http://books.zkoss.org/wiki/ZKDeveloper%27sGuide/FundamentalZK/ZKUserInterfaceMarkupLanguage/ComponentSetsandXMLNamespaces/MixWithAnotherMarkup_Language)), however it does not seem to support Command bindings.
Asked: 2014-11-25 15:34:17 +0800
Seen: 11 times
Last updated: Nov 25 '14
How to stop combining commands in an ajax call ?
zk.auSend not called on composer
Font Awesome Problem with IE8 when security option "font download" is disabled
Send a client event with JSON data
How to capture the Browser Window Resize/Size Event
Toggled Popup - Close ONLY on toggling, not on focus lost
Verify existence -Verificar existencia DNI