0

Disable selection for a Listbox

asked 2009-06-18 14:35:34 +0800

jyluo gravatar image jyluo
147 1 1

Hi, is there a way to disable selection by mouse click for a Listbox? This means users can not click to select Listitems, but the underlying program can still select them by calling Listbox.selectItem. Thanks.

delete flag offensive retag edit

8 Replies

Sort by ยป oldest newest

answered 2009-06-19 10:23:20 +0800

iantsai gravatar image iantsai
2755 1

I think this is a feature request, you can post it to http://sourceforge.net/projects/zk1/

link publish delete flag offensive edit

answered 2009-06-21 08:39:22 +0800

SergeTk gravatar image SergeTk
193 3

I don't know if this going to work as I never tried this myself.......
But what you could do is make all rows inside libox disabled (this Might stop mouse selection but might not)
if it does then all you do later on is just call setSelected on the row by underlying program...........

This is just a theory to try..........

link publish delete flag offensive edit

answered 2009-09-29 13:36:36 +0800

dastultz gravatar image dastultz
797 9

Disabling the listtems works, but it greys out everything. What I wanted was to disable selection by use of the row in general but maintain ability to select using the checkbox. I added this to each list cell:

listcell.setAction("onmouseover:stopEvent(event);onclick:stopEvent(event);");
listcell.setSclass("nopointer");

With this JS:

function stopEvent(event) {
	if (!event) var event = window.event
	event.cancelBubble = true;
	if (event.stopPropagation) event.stopPropagation();
}

and this css:
td.z-list-cell.nopointer {
	cursor: default;
}

/Daryl

link publish delete flag offensive edit

answered 2009-09-29 19:36:55 +0800

dastultz gravatar image dastultz
797 9

Well, it looked good, but didn't work. It seems the selection of an item is done via the cell/row rather than the checkbox. (Selecting a checkbox does not select the listitem.) I'll have to change things so the first cell under the checkbox is as usual.

/Daryl

link publish delete flag offensive edit

answered 2010-08-07 07:36:47 +0800

rohitwadke gravatar image rohitwadke
339 1 5

Can we maintain listbox state??
I have added data in to my listbox i have used person class with attribute name,image etc.
i want to add data then it should be disabled when i add next data, disabled data should remain same.
please give me solution...

link publish delete flag offensive edit

answered 2010-08-16 02:34:04 +0800

iantsai gravatar image iantsai
2755 1

@ rohitwadke

I think you should ask your question in other post, and I think this is a feature request so currently ZK doesn't has this feature.

link publish delete flag offensive edit

answered 2011-01-04 21:29:00 +0800

Sam2012 gravatar image Sam2012
9

you can set Listitem like this:

List<Listitem> list = listbox("operBox").getItems();
for(Listitem item : list){
	item.setDisabled(true);
}

link publish delete flag offensive edit

answered 2012-05-07 12:15:07 +0800

venkatdivvi gravatar image venkatdivvi
21

Its working fine.

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-06-18 14:35:34 +0800

Seen: 2,906 times

Last updated: May 07 '12

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