0

Issue disabling a listbox

asked 2008-07-08 16:33:41 +0800

Luuzz gravatar image Luuzz
109 1

Hello Everybody
I am new here ant i have few problems using listbox component.
In fact, i want to disable a listbox, but when i do, it becomes invisible.
Can someone please help me ?

delete flag offensive retag edit

7 Replies

Sort by » oldest newest

answered 2008-07-08 17:11:20 +0800

madruga0315 gravatar image madruga0315 flag of Brazil
937 2 12

Hey there,

So, in other words, you want the read-only feature for listbox?
So that when the listbox it´s read-only, the user can see the selected item text, but can´t change it?

/Madruga

link publish delete flag offensive edit

answered 2008-07-08 17:55:13 +0800

ansancle gravatar image ansancle
327 9

use disabled="true"

Ex..
<listbox disabled="true" rows="1" mold="select">
<listitem label="option1"/>
<listitem label="option2"/>
<listitem label="option3"/>
</listbox>

link publish delete flag offensive edit

answered 2008-07-08 20:07:17 +0800

Luuzz gravatar image Luuzz
109 1

I'm glad to get feedback so quickly !!
I have tried to use disabled="true" but this doesn't work, the listbox gets simply invisible.
Maybe this is because i didn't use rows="1" and mold="select". I'm gonna try this and let you know.

link publish delete flag offensive edit

answered 2008-07-09 09:29:20 +0800

Luuzz gravatar image Luuzz
109 1

I tried this and it's working great !
But i still don't understand why it doesn't work without these two attributes ...
Thank you all.

link publish delete flag offensive edit

answered 2008-07-09 12:42:48 +0800

ansancle gravatar image ansancle
327 9

You will get some different behavior out of the listbox depending upon which "mold" you are in. mold="select" means you have a single row drop-down list. In this case you don't need to specify the number of rows since it is implicit. If mold does not equal select then you do need to tell it how many rows you want the listbox to show. For example :

	<listbox width="250px" rows="5"/>

In this case it will show 5 rows.

If you do not specify mold="select" and you do not give it a number of rows the listbox will not show up.

I recommend you use the live demo to see sample code and test out different things to see what works and what does not, this tool is invaluable.

http://www.zkoss.org/zkdemo/userguide/

link publish delete flag offensive edit

answered 2008-07-23 10:58:10 +0800

hkn gravatar image hkn
246 3

Hello,

I have a quite similar problem. First I tried to disable the listbox in total by lbUsersTest.setDisabled(true) but that doesn't work. But I can disable the rows, respective <z:listitem> by looping over all items of the listbox and disable each of them. But my expectation of setDisable(true|false) is to disable a component in total and all its childs so that all events - specially selection clicks - are deactivated.
Am I right with my expectation?

As described before by someone else <...mold="select" > setDisabled() works but I loose all my columns, just one is kept !

Has anyone out there found a solution??

Thanks

<z:listbox width="99%" id="lbUsersTest" height="100px" disabled="true">
<z:listhead sizable="true">
<z:listheader label="Name" sort="auto" width="33%" />
<z:listheader label="Email" sort="auto" width="33%" />
<z:listheader label="Mail-In-Address" sort="auto" width="3%" />
</z:listhead>
<z:listitem disabled="true">
<z:listcell label="11"/><z:listcell label="12"/><z:listcell label="13"/>
</z:listitem>
<z:listitem>
<z:listcell label="21"/><z:listcell label="22"/><z:listcell label="23"/>
</z:listitem>
</z:listbox>

link publish delete flag offensive edit

answered 2008-07-30 15:30:38 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

Please post to feature request. Thanks.

link publish delete flag offensive edit
Your reply
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

Follow

RSS

Stats

Asked: 2008-07-08 16:33:41 +0800

Seen: 211 times

Last updated: Jul 30 '08

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