Dynamic listbox with one listitem as label

asked 2015-09-29 17:45:36 +0800

druiznyc gravatar image druiznyc
1 2

updated 2015-09-29 17:48:58 +0800

Not sure how to do this so looking for suggestions. We have dynamic dropdown list on our site for example:

    <listbox mold="select" rows="1">
        <listitem label="Taxi"/>
        <listitem label="Bus" selected="true"/>
        <listitem label="Train"/>

but when the list only has one listitem I would like the listbox to display as a label. So if I have

    <listbox mold="select" rows="1">
        <listitem label="Taxi"/>

I would like it to render as

<label value="Taxi" />

Any suggestions would be awesome, thank you

delete flag offensive retag edit


Is the listbox content size dynamic? I mean with this can it change size without leaving current page

chillworld ( 2015-09-29 17:59:04 +0800 )edit

Chillwood, No once the page is created it would remain the same.

druiznyc ( 2015-09-29 18:16:48 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2015-09-29 18:01:02 +0800

Darksu gravatar image Darksu
1991 1 4

Hello druiznyc,

Personally i would create a listbox or label dynamically in my controller depending on the size of the collection.

Another idea would be to create both components and set their visibility accordingly.

Finally you could use conditional evaluation as shown at the url below:


Best Regards,


link publish delete flag offensive edit

answered 2015-09-30 06:19:37 +0800

chillworld gravatar image chillworld flag of Belgium
5357 4 9

Hey Druiznyc,

Darksu is correct you can use the conditional evaluation.
The if attribute is not dynamic, so @load you can't use there.
The advantage of if against the usage of the visible attribute is that when you use if, it is not rendered in the HTML output, while visible is rendered.

I have made a sample where you can check the usage of it.

When you need it dynamic, you can use ZK8. There is a new component <if> what is dynamic.
It works with shadow elements in the dom.

Greetz chill.

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: 2015-09-29 17:45:36 +0800

Seen: 15 times

Last updated: Sep 30 '15

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