-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi all
i am trying to get the label value of the listcell in the java file but i am not getting ...
zul file <zk> <window title="new page title" border="normal" apply = "com.inventory.TransferStock1"> <listbox> <listhead> <listheader>Item</listheader> <listheader>Description</listheader> </listhead> <listitem> <listcell id ="ListCell" label = "e123" onClick="com.TransferStock.ListPopulate(event)"/> <listcell/> </listitem> </listbox> </window> </zk> Java File public class TransferStock extends GenericForwardComposer{ public static void ListPopulate(Event event) { System.out.println(event.getTarget().getId()); // here i m getting the id of the cell<b > but how to retrive the label of the cell ???</b> }
Hi
<zk> <window title="new page title" border="normal"> <listbox> <listhead> <listheader>Item</listheader> <listheader>Description</listheader> </listhead> <listitem> <listcell id="ListCell" label="e123" onClick="ListPopulate(event)" /> <listcell /> </listitem> </listbox> </window> <zscript> void ListPopulate(Event event) { //Here you got the component by getTarget() and directly get the label System.out.println(event.getTarget().getLabel()); } </zscript> </zk>
/Matthew
In your first example, did you ever get into the TransferStock::ListPopulate method?
Hi
<zk> <window title="new page title" border="normal"> <listbox id="xx"> <listhead> <listheader>Item</listheader> <listheader>Description</listheader> </listhead> <listitem> <listcell id="ListCell" label="e123" onClick="ListPopulate(event)" /> <listcell /> </listitem> </listbox> </window> <zscript> void ListPopulate(Event event) { //Here got the Listcell (in this sample we dont need to know what id is) and set its label event.getTarget().setLabel("xxxx"); } </zscript> </zk>
I think if you look at the API for Event::getTarget it returns a Component. If so, that be cast to a Label first and then run the getValue() method.
Asked: 2011-05-05 03:24:36 +0800
Seen: 314 times
Last updated: May 09 '11