0

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

asked 2011-08-10 09:08:34 +0800

cyiannoulis gravatar image 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?

thank you for your time

/costas

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2011-08-10 11:38:32 +0800

robertpic71 gravatar image 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();
	persons.add(new Person("Balu", "Haben"));
	persons.add(new Person("Sadira", "Jobs"));
	persons.add(new Person("Dacey", "Obert"));
	persons.add(new Person("Gabby", "Taffy"));
	Person selected = persons.get(0);
	</zscript>
	
	<listbox model="@{persons}" selectedItem="@{selected}" rows="5">
		<listhead >
				<listheader label="Name"/>		
		</listhead>
		<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

link publish delete flag offensive edit

answered 2011-08-11 02:21:34 +0800

cyiannoulis gravatar image 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

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2011-08-10 09:08:34 +0800

Seen: 248 times

Last updated: Aug 11 '11

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