Tuesday, July 30, 2013

How to call JavaScript Function from ViewModel(Java Class) in ZK

Today i will tell you how we can call Java Script function from view model of that particular zul , Let us suppose you have A.zul file something like this ...

Now you will want to call closeBrowser() method from your ViewModel I mean from MyViewModel.java class, So you have to write below code in your viewModel or Java class inside any method

Note:- I did not test the code but some of my team member already done this thing show i took help from them to write this blog entry and it will work because it is working in our application.


  1. I believe "]]>" should be before "end script" tag

  2. how to pass parameter to this javascript function. And parameter is value of zscript variable

    1. Its depend which version u r using right now? This code Written when i was working on ZK6+