0

Switching rows between 2 Listbox

asked 2009-12-10 04:38:22 +0800

cscalfo gravatar image cscalfo
3

Hi, I'm new to ZK. I need to create 2 listbox. 1 that is fill by a DB and the other that is fill by the user by selecting rows of the first one. How can I do this? Here is my source code:

				<window id="commande" title="Liste des commandes"
					apply="l4t.User.UserCommandes" border="normal">
					<listbox id="commandeslb" rows="5"
						model="@{commandeCtrl.model}" selectedItem="@{commandeCtrl.selected}">
						<listhead sizable="true">
							<listheader width="80px" label="DevisID" />
							<listheader label="Cours" />
							<listheader width="100px" label="Date début" />
							<listheader width="100px" label="Date fin" />
							<listheader width="150px" label="Prix" />
						</listhead>
						<listitem self="@{each=commande}">
							<listcell label="@{commande.idDevis}" />
							<listcell label="@{commande.cours}" />
							<listcell label="@{commande.datedeb}" />
							<listcell label="@{commande.datefin}" />							
							<listcell label="@{commande.prix}" />							
						</listitem>
					</listbox>
					<button label="Add Selection" id="add"  />
					<button label="Remove Selection" id="del"  />
					<button label="Add all" id="alladd"  />
					<button label="Remove all" id="alldel"  />

					<listbox id="panierlb" rows="5">
						<listhead sizable="true">
							<listheader width="80px" label="DevisID" />
							<listheader label="Cours" />
							<listheader width="100px" label="Date début" />
							<listheader width="100px" label="Date fin" />
							<listheader width="150px" label="Prix" />
						</listhead>
						<listitem self="@{each=commande}">
							<listcell label="@{commande.idDevis}" />
							<listcell label="@{commande.cours}" />
							<listcell label="@{commande.datedeb}" />
							<listcell label="@{commande.datefin}" />							
							<listcell label="@{commande.prix}" />							
						</listitem>
					</listbox>
				</window>

The first list is correctly set. But I don't know how to deal with a second List. Do I have to create another class? Do I have to use 2 models?

Thank you for your help.

delete flag offensive retag edit

2 Replies

Sort by » oldest newest

answered 2009-12-10 12:42:38 +0800

YamilBracho gravatar image YamilBracho
1722 2

updated 2009-12-10 12:43:02 +0800

Check the Zk explorer (http://www.zkoss.org/zkdemo/userguide/#l3)

link publish delete flag offensive edit

answered 2009-12-10 18:53:15 +0800

samchuang gravatar image samchuang
4084 4

Hi ~

You need to add event listener, when listbox1 onSelect event happen, get the value and add to the value to second listbox

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: 2009-12-10 04:38:22 +0800

Seen: 471 times

Last updated: Dec 10 '09

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