MVVM Bind calls getter multiple times

asked 2014-09-25 13:10:41 +0800

cyiannoulis gravatar image cyiannoulis
1191 10

updated 2014-09-25 13:12:59 +0800

A few days ago i posted this question indicating a possible bug related to the MVVM bind mechanism. The problem is that under certain circumstances a getter may be called multiple times, causing serious performance problems.

I created a simple ZKFiddle example with two pages. When the user selects one of the names on the main list the second page is loaded saying that the method getPositions() was called 6 times!

I am attaching a snapshot image from my machine:

image description

The problem is that on the ZKFiddle site everything works fine! I have tried the same example with many zk versions (7.0, 7.0.2, 7.0.3) both CE and PE editions having the same results on our machines.

Is there any possibility anyone of you to try the same zkfiddle code on his/her machine?

I am using:

Chrome 37.0.2062.124 m / Firefox 32.0.3

Eclipse version: 4.3.2.v20140221-1852 Build id: M20140221-1700

Windows 7

Thanks a lot for any help


delete flag offensive retag edit


A possible workaround is using listbox with "select" mold.

vincentjian ( 2014-09-29 02:18:38 +0800 )edit

Nope! Same thing either using selectbox or listbox. I dought this issue is related to the component. It must be something with the binder.

cyiannoulis ( 2014-09-30 09:03:05 +0800 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2014-09-25 13:51:56 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8

updated 2014-09-25 14:07:21 +0800

I am trying your example and it is saying called single time see attached image

image description


Above tested on Fiddle now i am testing in local machine


Tested your code in local machine get method is called 6 times

link publish delete flag offensive edit

answered 2014-09-25 15:02:45 +0800

cyiannoulis gravatar image cyiannoulis
1191 10

I think it is getting worse... in my sample page2.zul if you move the selectbox declaration outside of the grid (lets say at the beginning of the page) then the getter is getting called only once!!

<selectbox model="@load(vm.positions)" >
        <template name="model" var="position" >
            <label value="@load(position)" />

<div width="100%" > 

    <grid hflex="true">
            <column width="200px" />
            <column hflex="1" />

                <textbox value="@bind(vm.person.name)" />


    <button label="Save" onClick="@command('save')" />


link publish delete flag offensive edit


This issue only happened on PE/CE version, please try EE version. And it is also not suggest to have database transactions in view model getter.

vincentjian ( 2014-12-31 08:12:57 +0800 )edit

answered 2014-12-31 10:25:49 +0800

cyiannoulis gravatar image cyiannoulis
1191 10

updated 2014-12-31 10:40:35 +0800

But still not get it. PE is a payable version of ZK correct? And since it offers Data Binding out-of-the-box why do i have to buy the EE package to correct this problem? It is not a feature. It is a bug.

As for the getters, i agree they should not call database transactions.


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




Asked: 2014-09-25 13:10:41 +0800

Seen: 40 times

Last updated: Dec 31 '14

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