0

How to disable selection of a listbox

asked 2009-02-27 22:43:13 +0800

jyluo gravatar image jyluo
147 1 1

Or make a listitem unselectable?

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2009-02-27 23:43:14 +0800

james gravatar image james
255 2

	<listbox >
	    <listhead>
		<listheader label="H1" sort="auto" />
		<listheader label="H2" sort="auto" />
	    </listhead>
	    <listitem disabled="true" id="li_1">
		<listcell label="1" />
		<listcell label="2" />
	    </listitem>
	    <listitem>
		<listcell label="3" />
		<listcell label="4" />
	    </listitem>
	    <listitem>
		<listcell label="5" />
		<listcell label="6" />
	    </listitem>
	    <listitem>
		<listcell label="7" />
		<listcell label="8" />
	    </listitem>
	</listbox>
<button label="dis" onClick="li_1.disabled=true"/>
<button label="en" onClick="li_1.disabled=false"/>

link publish delete flag offensive edit

answered 2009-02-28 14:58:25 +0800

jyluo gravatar image jyluo
147 1 1

But this disabled the listbox, which changes its appearance. I want it to have the same appearance but not respond to things like mouse-over and mouse click..

link publish delete flag offensive edit

answered 2009-03-01 00:34:47 +0800

YamilBracho gravatar image YamilBracho
1722 2

I think you can write event handlers for those events and do what you want

link publish delete flag offensive edit

answered 2009-03-01 04:38:11 +0800

HananW gravatar image HananW
160 2

Just add the bellow code before the listbox code

<style>
tr.z-list-item-disd *, td.z-list-cell-disd * {
color:black !important;
}
</style>

link publish delete flag offensive edit

answered 2009-03-02 18:34:33 +0800

james gravatar image james
255 2

My code that i wrote, for me disabled just a certain list item (other items were selectable, just not the specific one specified with the id="li_1" tag) Notice the id is on the listitem, not the listbox.

As HananW wrote, you can use css to change the appearance of disabled items to look the same as enabled items.

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: 2009-02-27 22:43:13 +0800

Seen: 958 times

Last updated: Mar 02 '09

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