-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I want to expand & collapse windows & hbox on image button click.
Can anybody tell how to do it?
psingh,
Maybe something like the following:
<zk xmlns:w="http://www.zkoss.org/2005/zk/client" > <window> <hbox id="hbox1" width="500px" height="500px" style="border: 3px solid red;"> ... Stuff goes in here ... </hbox> <space height="25px"/> <button label="Click Me"> <attribute w:name="onClick"> jq(this.$f('hbox1')).slideToggle(500); </attribute> </button> </window> </zk>
Maybe that will give you an idea...
Todd
Well, then I think you need to have a Composer listening to the event coming from the botton and process it accordingly, see http://books.zkoss.org/wiki/ZK_Developer's_Reference/MVC/Controller/Composer.
Hope it helps
S
a little bit of code:
zul file
<?page id="ZKLoginDialog" title=" Login "?> <?link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" ?> <?link rel="icon" type="image/gif" href="/animated_favicon1.gif" ?> <?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?> <zk xmlns="http://www.zkoss.org/2005/zul" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:w="http://www.zkoss.org/2005/zk/client" xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd"> <window id="loginwin" border="none" width="475px" apply="org.opentruuls.base.webui.login.ZkLoginDialogCtrl"> <script type="text/javascript"> <![CDATA[ function submit() { document.f.submit(); } ]]> </script> // Rest of zul components here </window> </zk>
Java Controller
/** * when the "login" button is clicked. <br> * * @throws IOException */ public void onClick$btnLogin() throws IOException { . . . Clients.evalJavaScript("submit()"); // do submit }
best
Stephan
Asked: 2012-10-17 04:48:54 +0800
Seen: 158 times
Last updated: Oct 19 '12