-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi All,
I have a Table A having the following schema: a-id, a-name
public class A{
int id; //get&set methods
String name; //get&set methods
}
and Table B having the following schema: b-id, a-id {a-id is a foreign-key referring Table A}
public class B{
int id; //get&set methods(Foreign Key)
int idB; //get&set methods
}
I have a SQL statement that create a Model List for being used on the webpage:
select * from A left join B on A.a-id = B.a-id;
- which generates a-id, name, b-id
(aka C)
I created a grid using model as what (C) looks like. And there are 2 columns in the Grid namely:
B-ID, Name ( aka D)
I would like to create a combobox for column (D) to update a record in Table B; the combobox should looks like:
Label of a-name but use the value with <a-id>
May I ask how to achieve it; is there any relevant small talks / previous thread that I can refer to?
Thanks a lot.
Yes, you can set both label and value to a comboitem and then you can use Combobox.getSelectedItem().getValue() to replace Combobox.getValue()
sample:
<zk>
<combobox id="cbx">
<comboitem label="label one" value="value one" />
<comboitem label="label two" value="value two" />
</combobox>
<button label="test">
<attribute name="onClick"><![CDATA[
if (cbx.getSelectedItem() != null) {
System.out.println(cbx.getSelectedItem().getValue());
} else {
System.out.println("");
}
]]></attribute>
</button>
</zk>
Asked: 2013-02-04 06:49:12 +0800
Seen: 152 times
Last updated: Mar 05 '13
Didn't get your question very clearly, is it relates to UI or just your domain logic? maybe you should provide a simple one that relate to UI. and you can do the domain logic in the controller
dennis ( 2013-02-08 03:43:01 +0800 )edit