Show and hide tables on the basis of size of list box.

asked 2013-04-26 13:43:45 +0800

iamsudhir4u gravatar image iamsudhir4u flag of India
545 7

updated 2013-04-26 13:46:26 +0800

On my zul there are three components (list box , table and table).

 <zk xmlns:x="xhtml" xmlns:zk="zk">
        viewModel="@id('vm') @init('ListBoxTestViewModel')">

            <menuitem label="Add" onClick="@command('addCode')" />

        <listbox model="@bind(vm.folderSentenceListModel)"
                <listheader label="Code" />
                <listheader label="Details" />

            <template name="model">
                        <label value="@bind(each.code)" />
                        <label value="@bind(each.details)" />

                    <textbox value="@bind(vm.code)" width="150px" />

        <x:table />
                <textbox value="@bind(vm.details)" width="150px" />

I want these two tables only visible if

  • There is some record in list box.
  • Suppose there is no any record is present in list box and user is clicking on Add button then we are adding a row in list box.

Please suggest the best way to show and hide these table.

Thanks in Advance.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-04-30 10:30:38 +0800

cor3000 gravatar image cor3000
6094 2 7
ZK Team

updated 2013-04-30 10:31:58 +0800

to control the visibility dynamically you can surround the <x:table> elements by a <div> with "visible" attribute

<div visible="@load(!empty vm.folderSentenceListModel)">

and then add the @NotifyChange annotation to your @Command-method in your ViewModel

public void addItem() {
link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2013-04-26 13:43:45 +0800

Seen: 59 times

Last updated: Apr 30 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More