0

how to call js function from vm

asked 2013-02-19 19:31:45 +0800

maradolla gravatar image maradolla
3

I need to call one js function in view when vm updated some variable. actual problem is i tried to bind that variable to zk label component, but there is no event is firing when the value of label is changing.

delete flag offensive retag edit

4 Answers

Sort by ยป oldest newest most voted
2

answered 2013-02-21 12:02:49 +0800

psingh gravatar image psingh flag of India
963 8

updated 2013-02-21 12:03:33 +0800

If you want to call js function from your view model class then you have to write below code: In view model class:

Clients.evalJavaScript("f_test();");

in zul file

     <script>

            function f_test(){ 
                       alert("Test");
                    }
     </script>
link publish delete flag offensive edit
2
link publish delete flag offensive edit
2

answered 2013-02-20 10:06:35 +0800

hswain gravatar image hswain flag of India
1763 3 10
http://corejavaexample.bl...

in jul file

<button label="Click" xmlns:w="http://www.zkoss.org/2005/zk/client" w:onClick="demo();"></button>

or Java Code

button.setWidgetListener(Events.ON_CLICK, "demo();");
link publish delete flag offensive edit
2

answered 2013-02-20 05:02:27 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

See This may be it will help you to resolve your issue

link publish delete flag offensive edit
Your answer
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
1 follower

RSS

Stats

Asked: 2013-02-19 19:31:45 +0800

Seen: 90 times

Last updated: Jan 22 '14

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