-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, in a zk form I have a ListItem. On event onSelected I launch a function for setting various textbox.
My problem is "refreshing" this radiogroup when I set (on runtume) the value of txtEsame_attivo.
thanks
....
void onSelect_lstEsami(Listitem lsi){
Iterator itc=lsi.getChildren().iterator();
while(itc.hasNext()){
Listcell lsc=(Listcell)itc.next();
if(lsc.getListheader().getLabel().equalsIgnoreCase("Esame")){
txtEsame.setValue(lsc.getLabel());
}
else
if(lsc.getListheader().getLabel().equalsIgnoreCase("Attivo")){
txtEsame_attivo.setValue(lsc.getLabel());
chkEsame_attivo.setParent(txtEsame_attivo);
....
You can call radiogroup.invalidate() to redraw the UI.
/Jumper
Thank you for your reply jumperchen...
I tried to call .invalidate but this solution don't work .... any idea?
Thanks for yours replay....
Luca
I send you an example
<?xml version="1.0" encoding="UTF-8"?> <?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?> <zk xmlns="http://www.zkoss.org/2005/zul"> <window id="win" width="500px"> <listbox mold="paging" rows="13" id="lstEsami" width="700px" onSelect="onSelect_lstEsami(self.selectedItem)" > <listhead> <listheader label="Esame" width="10%" /> <listheader label="Descrizione" width="25%"/> <listheader label="Ok" width="5%"/> </listhead> <listitem self="@{each=ex}"> <listcell label="@{ex.Esame}" /> <listcell label="@{ex.Descrizione}" /> <listcell label="@{ex.Esame_attivo}" /> </listitem> </listbox> <grid> <rows> <row> Esame/Descrizione <hbox> <textbox id="txtEsame" maxlength="15" /> <textbox id="txtDesEsame" maxlength="35" /> </hbox> </row> <row> Attivo <hbox> <intbox id="txtEsame_attivo" /> <radiogroup id="chkEsame_attivo" selectedItem="@{txtEsame_attivo}"> <radio id="riEsame_attivo_true" value = "1" label="Attivo" /> <radio id="riEsame_attivo_false" value = "0" label="Non attivo" /> </radiogroup> </hbox> </row> </rows> </grid>
... and the code ....
<zscript> private class Order { private String esame; private String descrizione; private Boolean attivo; public String getEsame() { return esame; } public void setEsame(String esame) { this.esame = esame; } public String getDescrizione() { return descrizione; } public void setDescrizione(String descrizione) { this.descrizione = descrizione; } public Boolean getAttivo() { return attivo; } public void setAttivo(Boolean attivo) { this.attivo = attivo; } }
<![CDATA[ int count = 10; List orders = new LinkedList(); for(int j = 0; j < count; ++j) { Order o = new Order(); o.setEsame("Esame - " + j ); o.setDescrizione("Descrizione esame - " + j); o.setAttivo(false); orders.add(o); } List lstLabEsami = orders; ListModel lsmLabEsami = new SimpleListModel(lstLabEsami); lstEsami.setModel(lsmLabEsami); void onSelect_lstEsami(Listitem lsi){ Iterator itc=lsi.getChildren().iterator(); while(itc.hasNext()){ Listcell lsc=(Listcell)itc.next(); if(lsc.getListheader().getLabel().equalsIgnoreCase("Esame")){ txtEsame.setValue(lsc.getLabel()); } } txtEsame_attivo.setValue(0); chkEsame_attivo.invalidate(); } ]]> </zscript> </window> </zk>
Asked: 2009-09-03 17:01:09 +0800
Seen: 611 times
Last updated: Sep 04 '09