0

Form based save not working with select mode listbox

asked 2012-08-27 10:02:03 +0800

davout gravatar image davout
1435 3 18

I have a MVVM ZUL window where I'm using form level validation and in this form there are several 'select' mold listboxes. I've noticed that when I change a listbox selection the new selection is NOT being returned.

An extract from the ZUL a 'currency' listbox where the 'selectedItem' is being set and retrieved...

<panel title="@load(vm.viewTitle)" height="100%" width="100%"
	apply="org.zkoss.bind.BindComposer"
	viewModel="@id('vm') @init('com.eis.zk.workspace.detail.WorkspaceDefEditVM')"
	validationMessages="@id('vmsgs')"
	binder="@init(queueName='DataAreaQueue')">
	<panelchildren style="overflow:auto">
		<groupbox
			form="@id('fx') @load(vm.workspace) @save(vm.workspace, before='save') @validator(vm.formValidator)">
			<grid width="100%">
				<columns>
					<column label="" width="140px" />
					<column label="" />
				</columns>
				<rows>
					<row>
						<cell>
							<label value="Default reporting currency" />
						</cell>
						<cell>
							<listbox model="@load(fx.currencyModel)"
								selectedItem="@bind(fx.selectedCurrency)" mold="select">
								<listhead>
									<listheader label="" sort="auto" />
								</listhead>
								<template name="model" var="c">
									<listitem>
										<listcell
											label="@load(c.title)" />
									</listitem>
								</template>
							</listbox>
							<space />
							<label value="@bind(vmsgs['currency'])"  sclass="warning"/>
						</cell>
					</row>
					<row>
						<cell>
							<space />
						</cell>
						<cell>
							<button label="Save"
								onClick="@command('save')" />
							<space />
							<button label="Restore"
								onClick="@command('restore')" />
							<space />
							<button label="Cancel"
								onClick="@command('cancel')" />
							<space />
						</cell>
					</row>
				</rows>
			</grid>
		</groupbox>

	</panelchildren>
</panel>


An extract from the MVVMM class..

public class WorkspaceDO extends TitledDO {
   ...
   private static final long serialVersionUID = 5647030631764663513L;
   private ListModelList<CurrencyDO> fCurrencyModel;
   private CurrencyDO fSelectedCurrency;
   ...
   public ListModelList<CurrencyDO> getCurrencyModel() {
	return fCurrencyModel;
   }
   
   public void setCurrencyModel(ListModelList<CurrencyDO> currencyModel) {
	fCurrencyModel = currencyModel;
   }

   public CurrencyDO getSelectedCurrency() {
	return fSelectedCurrency;
   }

   public void setSelectedCurrency(CurrencyDO selectedCurrency) {
	fSelectedCurrency = selectedCurrency;
   }

}

public class WorkspaceDefEditVM extends AbstractWorkspaceDetailViewVM {
   ...
   private WorkspaceDO fWorkspace = new WorkspaceDO();
   ...
}	



Is this a bug or limitation with listbox?

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2012-09-11 02:45:23 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi davout,
What ZK version are you using?

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: 2012-08-27 10:02:03 +0800

Seen: 94 times

Last updated: Sep 11 '12

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