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.

Thursday, July 25, 2013

ZK Listbox selecteditem vs selecteditems

Today i am going to discuss about two attributes of zk Listbox, one is selectedItem and another is selectedItems both looking same but do not think like that here we can say selectedItems means Single selection or multiple selection both thing supported here but in case of selectedItem only one item of Listbox will be selected.

May be above comparison will be not clear to everyone, so we have to digg more and go to the depth of these attributes, lets go to ZK Official Documentation and see what they are saying about these two attributes

For single selection state, ZK provides 2 kind of state. One is selected index and another is selected item of a model. We can create 2 properties in ViewModel for them respectively.

Here you can see selectedItem means only one item will be selected and bind from ViewModel
Some components support multiple selections, but it needs to be enabled before using it. The way to enable multiple selections depends on property's type you bind with "model" attribute. If the property type is Java Collection type such as List, Set, or Map , we should specify multiple="true" on the component to enable multiple selections. If a property's type is ListModel and it implements Selectable, we should call setMultiple(true) to enable it.

While selectedItems means multiple items could be selected and bind with one variables but you have to remember that in your zul you have to add multiple="true" attribute in Listbox inside ZUL file and in your ViewModel you have to call setMultiple(true) function.

Thursday, July 18, 2013

How to avoid to load ZK Powered Logo?

As we know when any page load zk powered logo shown and if i am making any website or product for any individual client its not look good to me as well as client.

Now everyone know these design,look and feel and images are manage by CSS classes ,but sometime its hard to know which CSS used by ZK,for this above issue you can override some css class and css class which you have to override .
This Css used by ZK



Now you can change image or no any image

background-image:none

For more information you can check this question , i am using ZK EE may be because in my case above thing working .

Wednesday, July 10, 2013

ZK:-Diffence between @load and @bind?

Hello friends today we will discuss about two very basic but powerful annotation of ZK Framework load and bind



When i started ZK framework i am also in the same situation what i mean confused? Why we are using load and why we are bind in zul file for binding, i knew that both are for binding the ViewModel or Java Class variables with zul page but when i have to use load and when i have to use bind its sometime confusing for beginner.

Today I will try to explain you about it .Here we can say in simple words
@load:- One way binding
@bind:- Two way binding


Still some confusion? its ok not a big deal ...Let me try to explain one more time
Let me explain things with some scenario,let us suppose we have a zk textbox now in this case how binding will work?


In Simple words if you want to show the value in zul file from your viewmodel use @load and if you want to show the value and update value of viewmodel variable from zul use @bind If Still confusion ? please ask in comment .:)

Tuesday, July 9, 2013

ZK 6.5.3 officially released !!

Good news for ZK developer ,as i read official post of ZK Team ,Happy to announce ZK6.5.3 with new changes and bug fixes

Wednesday, July 3, 2013

ZK Listbox Filtering

Today i am going to tell you how can we do Filtering in the Zk Listbox ..Its Simple Basic demo example to apply the filtering in zk Listbox any one can get idea and added more well defined way to apply filtering in Zk Listbox

ZUL code for this listbox filtering example


And ViewModel or Java Code for Listbox filtering


You can download the above code from This link. Suggestion and updates invited :)