Posted Wednesday, December 31, 1969 @ 23:59:59
Steve, There are two ways to do this
1) Using setBoundSql() method in column
Lets say your query is select emp_name , dept_name...
and dept_name is foreign key, then
dBTable1.getColumn(1).setBoundSql("select distinct dept_name from dept..")
2) Using setCellComponent() method in DBTable
Lets say your query is select emp_name , dept_no...
and dept_no is foreign key, also lets say you don't want to display dept_no in table, instead you would like to show dept_name, but whenever there is a update, you want to update the dept_no,then
//create quicktable with query select emp_name,dept_no..
// execute a query separately through jdbc to your database with "select distinct dept_no , dept_name from dept"
//from the resultset create a hashtable
Hashtable h = new Hashtable();
while(rs.next())
{
h.put(rs.getString(1),rs.getString(2));
}
Column c = dBTable1.getColumn(2);
dBTable1.setCellComponent(c,Column.COMBOBOX_CELL,h);
The second feature(setCellComponent()) is available only in new version of quicktable, please download again.
Let me know whether that solves your problem.
Thanks
Ben
Ben,
I'd like to use a function similar to a foreign key
for several of my columns. I've like to be able to
"display" one value on the table but when selected
with a combo box, actually insert that values key
into the database (not the displayed value). Does
this make sense? Is there a way to do it or will I
need to play with some Cell editor/render
combinations myself? -- Steve