First time here? Check out the FAQ!
On my zul there are three components (list box , table and table).
<zk xmlns:x="xhtml" xmlns:zk="zk">
<window
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('ListBoxTestViewModel')">
<menubar>
<menuitem label="Add" onClick="@command('addCode')" />
</menubar>
<listbox model="@bind(vm.folderSentenceListModel)"
selectedItems="@bind(vm.selectedFolderSentenceItems)">
<listhead>
<listheader label="Code" />
<listheader label="Details" />
</listhead>
<template name="model">
<listitem>
<listcell>
<label value="@bind(each.code)" />
</listcell>
<listcell>
<label value="@bind(each.details)" />
</listcell>
</listitem>
</template>
</listbox>
<x:table>
<x:tr>
<x:td>
<textbox value="@bind(vm.code)" width="150px" />
</x:td>
</x:tr>
</x:table>
<x:table />
<x:tr>
<x:td>
<textbox value="@bind(vm.details)" width="150px" />
</x:td>
</x:tr>
</x:table>
</window>
</zk>
I want these two tables only visible if
Please suggest the best way to show and hide these table.
Thanks in Advance.
to control the visibility dynamically you can surround the <x:table>
elements by a <div>
with "visible" attribute
<div visible="@load(!empty vm.folderSentenceListModel)">
<x:table>
...
</x:table>
</div>
and then add the @NotifyChange annotation to your @Command-method in your ViewModel
@Command("addCode")
@NotifyChange("folderSentenceListModel")
public void addItem() {
...
}
Asked: 2013-04-26 13:43:45 +0800
Seen: 59 times
Last updated: Apr 30 '13