0

problem in event

asked 2011-05-05 03:24:36 +0800

raj gravatar image raj
126 1

updated 2011-05-05 03:25:27 +0800

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>
	    
	    
}

  

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2011-05-05 06:42:57 +0800

matthewgo gravatar image matthewgo
375

updated 2011-05-05 06:44:12 +0800

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

link publish delete flag offensive edit

answered 2011-05-05 07:40:02 +0800

raj gravatar image raj
126 1

Thanks Matthew,
i used your idea i got but one more doubt. here i am not able to set the label value why??

i tried but it's not working.

link publish delete flag offensive edit

answered 2011-05-05 12:22:36 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

In your first example, did you ever get into the TransferStock::ListPopulate method?

link publish delete flag offensive edit

answered 2011-05-06 00:04:26 +0800

raj gravatar image raj
126 1

@Cary: Yes i am getting the id of the Listcell in the ListPopulate().

link publish delete flag offensive edit

answered 2011-05-06 12:57:23 +0800

matthewgo gravatar image matthewgo
375

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>


Here I got a listcell so I set its label
if I got a Label , I should set its value .
Plz refer zk api

link publish delete flag offensive edit

answered 2011-05-06 15:49:19 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

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.

link publish delete flag offensive edit

answered 2011-05-09 06:40:43 +0800

raj gravatar image raj
126 1

Thanks matthewgo & Cary i got Solution..

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-05-05 03:24:36 +0800

Seen: 314 times

Last updated: May 09 '11

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