-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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
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
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>
Asked: 2011-09-02 07:20:44 +0800
Seen: 344 times
Last updated: Sep 05 '11