-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello, i'm trying to use this code to use the data binding:
<zk> <window> <zscript> <![CDATA[ import com.wsm.mmo.beans.Table; import com.wsm.zul.models.TablesModel; import org.zkoss.bind.impl.BinderImpl; TablesModel model = new TablesModel(); void doOrientationChange(ClientInfoEvent evt) { if ("portrait".equals(evt.getOrientation())) { main.setWidth("100%"); Clients.resize(content); } else { if (!execution.isBrowser("mobile")) main.setWidth("100%"); else main.setWidth("80%"); Clients.resize(content); } } void changeSomething() { Table tab = model.getTables().get(0); model.setCurrentTable(tab); tab.setDescription("cicciociccio1"); model.setTable(); } ]]> </zscript> <vlayout id="main" onClientInfo="doOrientationChange((ClientInfoEvent)event)" width="${zk.mobile > 0 ? '80%' : '100%'}" apply="com.wsm.zul.controllers.TablesController" viewModel="@id('vm') @init(model)"> <div id="content" sclass="main-content"> <textbox id="mainTrigger" onChange="@command('refreshTables')"></textbox> <grid id="gridTables" model="@bind(vm.tables)" mold="paging" autopaging="true" vflex="true" > <auxhead> <auxheader label="Table List" colspan="5" /> </auxhead> <columns> <column width="60px">Id</column> <column hflex="4">Table Name</column> <column hflex="5">Num Players</column> <column hflex="2">Buy In</column> </columns> <template name="model" var="table"> <row> <label value="@bind(table.tableid)"/> <label value="@bind(table.description)"/> <label value="@bind(table.numPlayer)"/> <label value="@bind(table.buy_in)"/> </row> </template> </grid> </div> <button onClick="changeSomething()" label="Change 1" /><button onClick="@command('setTable')" label="Change 2" /> </vlayout> </window> </zk>
Actually the data binding is correctly started at load. Now i want to change someting on my table using the first button. So i get a table and i change the description. but i cannot refresh automatically the grid. If i use the second button after the first one the grid is refreshed correctly. So my question is. Is there a way to use the @command also using zscript?
Thank you
@afxgroup Inline Editing and when you will press this button it will save into the database otehrwsie inline will automatically changed it.
Asked: 2012-10-09 15:43:42 +0800
Seen: 118 times
Last updated: Oct 11 '12