0

Id of object not recognized in zscript

asked 2011-09-09 10:32:56 +0800

dparisi gravatar image dparisi
6

updated 2011-09-09 10:33:34 +0800

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

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2011-09-19 04:13:14 +0800

vincentjian gravatar image vincentjian
2245 6

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.

link publish delete flag offensive edit

answered 2011-09-20 01:57:07 +0800

dparisi gravatar image dparisi
6

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.

link publish delete flag offensive edit

answered 2011-09-20 23:08:46 +0800

vincentjian gravatar image vincentjian
2245 6

Davide,

Please reference this article that clarify ID space.

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-09-09 10:32:56 +0800

Seen: 152 times

Last updated: Sep 20 '11

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