0

Combobox tooltip adjusting to it's value with data binding validation

asked 2011-09-02 07:20:44 +0800

id9848949 gravatar image id9848949
12

Hi,

I use combobox with model and save-when in selectedItem attribute. I can't find out how to set combobox's tooltiptext to combobox's value if I'm using save-when. Without it, it works like in following example:

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
<zk>
	<zscript><![CDATA[
	List list = new ArrayList();
	list.add("GroupOffice is a groupware suite that takes your office online.");
	list.add("Sonar enables you to collect, analyze, and report metrics on source code.");
	list.add("Coccigrep is a semantic grep for the C language.");
	String item;
	]]>
	</zscript>
	<combobox model="@{list}" selectedItem="@{item}" readonly="true" width="20em" tooltiptext="@{item}">
	  <comboitem self="@{each='item'}" label="@{item}" value="@{item}" />
	</combobox>
	<button id="save" label="Save" />
</zk>

But if I add "save-when='save.onClick'" to selectedItem, it does not work (as expected). How can I solve it?

Regards,
Pavel Arnost

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2011-09-02 10:39:41 +0800

robertpic71 gravatar image robertpic71
1275 1

Try this:

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
<zk>
	<zscript><![CDATA[
	List list = new ArrayList();
	list.add("GroupOffice is a groupware suite that takes your office online.");
	list.add("Sonar enables you to collect, analyze, and report metrics on source code.");
	list.add("Coccigrep is a semantic grep for the C language.");
	String item;
	]]>
	</zscript>
	<combobox model="@{list}" selectedItem="@{item, save-when='self.onChange,save.onClick'}" readonly="true" width="20em" tooltiptext="@{item}">
	  <comboitem self="@{each='item'}" label="@{item}" value="@{item}" />
	</combobox>
	<button id="save" label="Save" />
</zk
>

I use both: default + onClick binding

/Robert

link publish delete flag offensive edit

answered 2011-09-05 03:27:39 +0800

id9848949 gravatar image id9848949
12

Thanks. I want to commit all fields at once, so I ended with:

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
<zk>
	<zscript><![CDATA[
	List list = new ArrayList();
	list.add("GroupOffice is a groupware suite that takes your office online.");
	list.add("Sonar enables you to collect, analyze, and report metrics on source code.");
	list.add("Coccigrep is a semantic grep for the C language.");
	String item;
	]]>
	</zscript>
	<combobox model="@{list}" selectedItem="@{item, save-when='save.onClick'}" readonly="true" width="20em" tooltiptext="@{item}" onChange='self.tooltiptext=self.value'>
	  <comboitem self="@{each='item'}" label="@{item}" value="@{item}" />
	</combobox>
	<button id="save" label="Save" />
</zk>

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-09-02 07:20:44 +0800

Seen: 343 times

Last updated: Sep 05 '11

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