-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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
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
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
<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???
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>
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
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());
}
}
Are you using multiple=true and checkmark=true or you are using a another checkbox component with listbox?
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());
}
}
}
Asked: 2011-02-16 14:58:35 +0800
Seen: 1,111 times
Last updated: Feb 08 '18