0

zAu.send problems - basic question - call method on GenericForwardComposer from javascript

asked 2012-06-19 12:52:41 +0800

ansancle gravatar image ansancle
317 9

I have hunted through the forums and documentation, and apologize since I know I should have been able to figure this out, but have had no luck so far.
I have read all the docs related to this already, so please don't refer me to them. I am looking for a simple working example.

I want to call a method on a GenericForwardComposer class from within javascript in my zul file. The javascript is actually being called from an Ipad app, so I can't call it from within my <window> or any other zul object to help get a reference to the window object. I need to make the call to the server from purely within javascript. I don't have to pass any data, I just need that call on the server made.

The method on the server is shown below "callCleanup", I just want to call this from within a javascript function.

My java file is :

public class DHzHomeView extends DHzGenericForwardComposer
{

  public void callCleanup(Event event)
 {
   ....
 }

...
}

My zul file is :

		 
<script type="text/javascript">

  function callCleanup()
   {		
       /*  THIS CALL DOES NOT WORK */
       zAu.send(new zk.Event(zk.Widget.$(jq('$_homeWindow')[0]), 'callCleanup', null, {toServer:true}));	
  }	
 </script>

window id="_homeWindow" border="normal" apply="com.dh.ui.ipad.view.DHzHomeView"  height="100%" width="100%">	

.....

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2012-06-19 15:08:27 +0800

ansancle gravatar image ansancle
317 9

I managed to get the send to work (at least it appears to be via firebug) with the following call in javascript.
What I need now is how to catch this on the server in my GenericForwardComposer class?

   function callCleanup()
{	
	var windowWidget = zk.Widget.$('$_homeWindow');
       zAu.send(new zk.Event(windowWidget, 'onCleanup',null));
}

link publish delete flag offensive edit

answered 2012-06-19 16:39:38 +0800

ansancle gravatar image ansancle
317 9

I figured this out myself finally, here is how you do it :

If you are using GenericForwardComposer as I described above, simply define a method in the java class that matches the name used in the zAu.send call :

zAu.send(new zk.Event(windowWidget, 'onCleanup',null));

public void onCleanup(Event event)
{

}

With the javascript code I show above in my previous posts - this java method in your GenericForwardComposer will get called if you call the javascript function "callCleanup".

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: 2012-06-19 12:52:41 +0800

Seen: 206 times

Last updated: Jun 19 '12

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