0

How to activate client side action

asked 2006-03-04 15:52:27 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3610625

By: tskale

I have the following code fragment:

<button label="Doit" action="onclick:funA()">
<attribute name="onClick">
process(); </attribute>
</button>

The funA()needs to be called on the client only after process() method is evaluated.
The logic in the process() method will decide if funA() should be executed or not. As it stands now, I have no control over funA(). Is there a way to call
funA() from within process() method?

Any help in how to implement this will be appreciated.

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2006-03-05 10:19:14 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3611356

By: nobody

What you request is really the bottom line of how Ajax is working.

I think ZK team should be able to provide some kind of special component that user can "run" a specific javascript programmatically, etc.

Say,

<javascriptrunner id="myRunner" action="funA();"/>

and the server code can call an API like myRunner.run(), thus the funA() javascript would be run programmatically.

The better part is that you can dynamically download the javascript into the action attribute and basically you can "inject" javascript dynamically. Of course, in such case, you have to handle all the browser compatiblity issue. I don't know why you need to write your own javascript. Personally, I feel that ZK has provided enough components.

Anyway, good luck. Maybe you want to post a request to them?

My 2 cents.


link publish delete flag offensive edit

answered 2006-03-05 12:24:34 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3611447

By: tskale

I am integrating Google Map API in my application. To load data on map, I have to use Javascript and use XMLHTTPRequest in the browser since the map component which is embedded in the ZK iframe is not available on the server side (or I don't know how to access it)

The ability to communicate with Javascript objects in browser is, I think, a must. This will allow one to create location based applications using Yahoo or Google APIs.

Laszlo provides such functionality with their LzBrowser object but I liked ZK's approach to Ajax and so tried to use their platform.

link publish delete flag offensive edit

answered 2006-03-05 15:50:02 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3611649

By: tomyeh

CSA is independent of ZK's default behavior. In your class, funcA shall be executed (as JavaScript) at the client, while process is executed (by BeanShell) at the server.

link publish delete flag offensive edit

answered 2006-03-05 15:54:43 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3611652

By: tomyeh

I know nothing about Google Map API -- yet :)

If I read correctly, the Map object is in an iframe. Then, you want to talk back the server when intercepting some events sent by Google Map API. Right?

In this case, you could use

parent.zkau.send(...)

The parent of iframe (at the client) is where other ZK components and JavaScript codes reside.

You might also take a look at fileupload-done.dsp in zul.jar. Fileupload is done in an iframe, too.

Good luck and share us any progress.

link publish delete flag offensive edit

answered 2006-03-05 22:42:47 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3612179

By: tskale

Thanks for the help.
I got it to work now.

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: 2006-03-04 15:52:27 +0800

Seen: 679 times

Last updated: Mar 05 '06

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