1

Check box select event in list box

asked 2011-02-16 14:58:35 +0800

din gravatar image din
251 1 5

I want to call a method when user checks the checkbox in the listbox. How can I do that in the composer class?
I tried the onSelect and onEvent but could not do that. Can anybody help me handling the issue??

Thanks,
Dino

delete flag offensive retag edit

10 Replies

Sort by ยป oldest newest

answered 2011-02-16 18:36:10 +0800

samchuang gravatar image samchuang
4084 4

Hi

refer to Checkbox, it use onCheck event

link publish delete flag offensive edit

answered 2011-02-16 18:59:41 +0800

din gravatar image din
251 1 5

Hi samchuang, i am not using the checkbox alone, i am using it in a listbox. So once a user selects a row from the list I want to show a message to the user. I don't know how can I add an eventlistner to the listcell..do you have nay idea on the same line???

Thanks,
Dino

link publish delete flag offensive edit

answered 2011-02-16 21:16:21 +0800

samchuang gravatar image samchuang
4084 4

Hi, how do you create checkbox inside listbox ? could you provide your sample code ?

if you are using ComboitemRenderer, you can add event when you create checkbox

if this is not your test case, please provide your sample code

link publish delete flag offensive edit

answered 2011-02-17 12:18:08 +0800

din gravatar image din
251 1 5

updated 2011-02-17 12:19:38 +0800

<panel sclass="bg-panel-header" width="95%" >
<panelchildren >
<listbox use="test.BaseZkTable"
fixedLayout="true"
rvlsort="true"
rvlcolumn="false"
rvlselect="true"
rvlfilter="true"
tableShape="rsltList"
rvlmodelid="search"
id="rsltList"
style="white-space:wrap; background:#ffffff; height:580px;"
multiple="false"
checkmark="true"
tableSimpleActions=""
tableItemActions=""
customTableActions=""
rvlmodelfactory="test.SrchResult"
>
</listbox>
</panelchildren>
</panel>

This is the zul file code when SrchResult class gets executed i get a list of result with radiobutton...now when user checks the button I want to show some message..how can I do that in my composer class???

link publish delete flag offensive edit

answered 2011-02-17 18:48:33 +0800

samchuang gravatar image samchuang
4084 4

Hi

you can use onSelect event

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<zscript><![CDATA[
import org.zkoss.zul.*;
import org.zkoss.zk.ui.event.*;
class MyCtrl extends org.zkoss.zk.ui.util.GenericForwardComposer {
	Listbox lb;

	public void onSelect$lb(SelectEvent evt) {
		System.out.println(evt.getTarget());
		Set seld = evt.getSelectedItems();
		for (Object o : seld) {
			System.out.println(o);
		}
	}
}
]]></zscript>
<div>
<listbox id="lb" multiple="false" 
checkmark="true"  apply="MyCtrl">
	<listitem id="item1">
		<listcell label="Cell 1" />
	</listitem>
	<listitem id="item2">
		<listcell label="Cell 2" />
	</listitem>
</listbox>
</div>
</zk>

link publish delete flag offensive edit

answered 2013-01-05 15:22:35 +0800

gercibert gravatar image gercibert
9 1

Good morning .-

Please help me, I like retrieve the information checked in a ListBox.-

UnderLine Textweb.zul
/***** sources zk . zul ******/
<listbox id="listBoxPrueba" hflex="1" vflex="true"
mold="paging"
selectedItem="@{idwin$composer.pruebaSelected}"
sizedByContent="true" pageSize="10"
multiple="true" checkmark="true" style="text-align:left">
<listhead>
<listheader label="Cod width="120px" />
<listheader label="descripcion1" />
<listheader label="decripcion2" />
</listhead>
</listbox>

UnderLine Textbacking
/**** source java *******/
public void onSelect$listBoxPrueba(SelectEvent evt) {
if (!Funciones.esVacio(pruebaSelected)) {
Set<String> tempSet = new HashSet<String>();
tempSet = evt.getSelectedItems();

}

tempSet = evt.getSelectedItems(); ----- this object return the list correctly, but I like the all items of list cheked...

help me please

link publish delete flag offensive edit

answered 2013-01-05 15:51:23 +0800

gercibert gravatar image gercibert
9 1

I want to do something like :

example:
Backing class:

private List<Object> nombre;
private nombreClase testSelected;

public void onSelect$listBoxTest(SelectEvent evt) {
if (!Funciones.esVacio(testSelected)) {
List<Object> listValue= new ArrayList<Object>();
listValue= getSelectedItems(); //this not can

for(int i<Object obj : listValue){
System.out.println(obj .getCodigo());
}
}

link publish delete flag offensive edit

answered 2013-01-05 17:15:55 +0800

sjoshi gravatar image sjoshi flag of India
3508 1 8
http://zkframeworkhint.bl...

Are you using multiple=true and checkmark=true or you are using a another checkbox component with listbox?

link publish delete flag offensive edit

answered 2013-01-06 04:07:36 +0800

hswain gravatar image hswain flag of India
1765 3 10
http://corejavaexample.bl...

you can use look like this.

public void onSelect$listBoxTest(SelectEvent evt) {

if (evt.getSelectedItems() != null) {
Set<Listitem> selectedItems = evt.getSelectedItems();
for (Listitem tempItem : selectedItems) {
System.out.println(tempItem.getValue());
}

}
}

link publish delete flag offensive edit

answered 2018-02-08 21:25:02 +0800

javiut gravatar image javiut flag of Venezuela, Bolivarian Republic of
90 1 5

I want to know if the checkbox/radiobutton was checked or unchecked including the general the one in the listheader please help me out.

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: 2011-02-16 14:58:35 +0800

Seen: 1,062 times

Last updated: Feb 08