Problem with moving around a picklist column


2004-08-20 08:35:09 PM
jbuilder13
hi all
i got a strange problem with the jdbtable and a column which is a picklist.
I hope someone can verify this and say that this is not only an error that i
get.
Let's say you have a querydataset with 2 columns. the first is the row_id
and the second is a value 0 or 1. make a picklist for the second column with
a storagedataset or so. now, like you would think its normal, you can choose
the value for the second column with your picklist, cool row is posted. Move
the column now in front of the other column ("value" should now be the first
column). Try to change the value with the picklist and click somewhere in
the table. In my case i can't do that because i will get an errormessage
"unable to post row because of invalid field value".
I don't know where the problem occurs.
Would be great if you have a solution to this :)
Thank you
Martin
Here's the code:
public class Frame1
extends JFrame {
BorderLayout borderLayout1 = new BorderLayout();
TableScrollPane tableScrollPane1 = new TableScrollPane();
JdbTable jdbTable1 = new JdbTable();
Database database1 = new Database();
StorageDataSet storageDataSet1 = new StorageDataSet();
Column column2 = new Column();
Column column3 = new Column();
QueryDataSet queryDataSet1 = new QueryDataSet();
Column column1 = new Column();
public Frame1() {
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
void jbInit() throws Exception {
this.getContentPane().setLayout(borderLayout1);
database1.setConnection(new
com.borland.dx.sql.dataset.ConnectionDescriptor(
"jdbc:oracle:oci8:@w2dev817.datasign.ch", "acl20_user",
"acl20_user", false,
"oracle.jdbc.driver.OracleDriver"));
column2.setCaption("ID");
column2.setColumnName("ID");
column2.setDataType(com.borland.dx.dataset.Variant.BIGDECIMAL);
column2.setDefault("0");
column2.setPreferredOrdinal(0);
column2.setServerColumnName("ID");
column2.setSqlType(0);
column3.setCaption("TEXT");
column3.setColumnName("TEXT");
column3.setDataType(com.borland.dx.dataset.Variant.STRING);
column3.setDefault("FALSE");
column3.setSortPrecision( -1);
column3.setPreferredOrdinal(1);
column3.setServerColumnName("TEXT");
column3.setSqlType(0);
storageDataSet1.setColumns(new Column[] {column2, column3});
storageDataSet1.addOpenListener(new
Frame1_storageDataSet1_openAdapter(this));
queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(
database1, "select id, wert from table1", null, true, Load.ALL));
column1.setColumnName("WERT");
column1.setDataType(com.borland.dx.dataset.Variant.BIGDECIMAL);
column1.setPickList(new com.borland.dx.dataset.PickListDescriptor(
storageDataSet1, new String[] {"ID"}
, new String[] {"ID", "TEXT"}
, new String[] {"WERT"}
, "TEXT", false));
column1.setScale(0);
column1.setTableName("TABLE1");
column1.setServerColumnName("WERT");
column1.setSqlType(2);
queryDataSet1.setColumns(new Column[] {column1});
jdbTable1.setDataSet(queryDataSet1);
this.getContentPane().add(tableScrollPane1, BorderLayout.CENTER);
tableScrollPane1.getViewport().add(jdbTable1, null);
}
void storageDataSet1_opened(DataSet dataSet) {
DataRow dr = new DataRow(storageDataSet1);
dr.setBigDecimal("ID", new BigDecimal("0"));
dr.setString("TEXT", "FALSE");
storageDataSet1.addRow(dr);
dr.setBigDecimal("ID", new BigDecimal("1"));
dr.setString("TEXT", "TRUE");
storageDataSet1.addRow(dr);
}
}