# Data binder default behavior VS save-when='none' has no impact on speed

cyiannoulis
1191 10

Hi to all,

Normally, in most cases, i use the data binder mechanism "as is" without changing its default behavior

<textbox value="@{ controller.value }" />


I use the "save-when" attribute only when i need to update the model manually

<textbox value="@{ controller.value, access='both', save-when='none' }" />


Recently, due to some technical issues related to satellite communications, we are facing problems with the latency. While i was trying to optimize some pages, i thought i could improve the responsiveness by changing the data binder's behavior to "save-when=none" only to find out that this had no impact. I thought that, by default, whenever the user changes the value of a binded control, the client communicates automatically behind the scenes with the server to update the model. It seems that the client "packs" all modified values and sends them all together to the server whenever there is a need for event handling. Is this right or am i confused?

/costas

delete retag edit

## 2 Replies

robertpic71
1275 1

Hi,

first i've tested save-when='none' and save-when=button.onClick inside the livedemo (5.0.8 FL) --> it works as expected.

I use Firefox 5, ZK Sandbox Databinding example and Firebug Network/All (clear before change).

Original Code: Change one field and press tab --> 1 POST --> return 116 Bytes

Modified code (test save-when='none' and save-when=button.onClick)
--> change and press tab --> no traffic, onClick --> traffic

Here is my modified testcode

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="./mywin"?>
<window id="mywin" border="none">
ZK name check list :
<zscript>
//init example data beans
import org.zkoss.zksandbox.Person;
List persons = new ArrayList();
Person selected = persons.get(0);
</zscript>

<listbox model="@{persons}" selectedItem="@{selected}" rows="5">
<listitem self="@{each=person}" label="@{person.fullName}" />
</listbox>
<grid>
<columns>
<column label="First Name" />
<column label="Last Name" />
<column label="Full Name" />
<column/>
</columns>
<rows>
<row>
<textbox value="@{selected.firstName, save-when=save.onClick}" />
<textbox value="@{selected.lastName, save-when=save.onClick}" />
<label value="@{selected.fullName}" />
<button id="save" label="Save"/>
</row>
</rows>
</grid>
</window>


/Robert

cyiannoulis
1191 10

Thank you Robert. You are right. I have done the same test with similar results. ZK behaves exactly as expected. Probably in my case something curious is happening and the cause must be the complicate network infrastructure.

Thank you again for your time.

/costas

[hide preview]