-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hy at all, i use ZK 5.0.7.1 CE and i have the following file ".zul":
<code>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
<zk>
<zscript><![CDATA[
import com.test.db.Funzioni;
import com.test.db.AreeFunzionali;
import com.test.db.FunzioniHome;
List allFunction = new FunzioniHome().findAll();
void select() {
int selIndex = lbxFunctions.getSelectedIndex();
Listitem appo = lbxFunctions.getItemAtIndex(selIndex);
Funzioni currentFnz = new FunzioniHome().findById(new java.math.BigDecimal(appo.getLabel()));
String currentAreaCod = currentFnz.getAreeFunzionali().getAfiCod();
Messagebox.show(areaAssociata.getName());
}
]]></zscript>
<borderlayout width="100%" height="100%" >
<west id="westwin" autoscroll="true" title="Funzioni" size="195px" maxsize="195" open="true" >
<div >
<listbox id="lbxFunctions" selectedItem="@{selected}">
<listhead>
<listheader label="Area" sort="auto"/>
<listheader label="Funzione" sort="auto"/>
</listhead>
<listitem forEach="${allFunction}" value="${each}">
<listcell visible="false" label="${each.fnzId}"/>
<listcell onClick="select()" label="${each.areeFunzionali.afiDescr}"/>
<listcell onClick="select()" label="${each.fnzDescr}"/>
</listitem>
</listbox>
</div>
</west>
<center id="wincenter" autoscroll="true" >
<window apply="com.test.web.zk.CnfsComposer1" title="Dati Funzione corrente" width="100%" height="100%" border="normal">
<div>
<label sclass="z-f-etichetta" value="Funzione:" /><label value="@{selected.fnzDescr}" /><separator/>
Area associata: <combobox readonly="true" id="areaAssociata">
</combobox><button label="imposta" onClick="" />
</div>
</window>
</center>
</borderlayout>
</zk>
</code>
Because in the "zscript" section during the development (in eclipse) and at runtime i have an error "areaAssociata cannot be resolved"?, this is the id of combobox defined in the window tag.
Thanks at all.
Davide
Hi Davide,
Maybe give an id for window component called "winId", then get the combobox by winId.getFellow("areaAssociata"); in zscript will solve the problem.
Vince, thanks for your reply.
Your solution seems to be work.
The api doc for "getFellow" says: "Returns a component of the specified ID in the same ID space. Components in the same ID space assinged with ID are called fellows.", i have to study the concept of "space" because is not clear for me.
Thanks and regards.
Asked: 2011-09-09 10:32:56 +0800
Seen: 152 times
Last updated: Sep 20 '11