Posted Thursday, April 26, 2007 @ 05:53:09
Hi,
am using refresh(vectorofVectors) to create the first row for the table and then using
insert to add more rows.
the refresh() works fine and displays the first row, but the insert() doesnt seem to work
i.e the second row doesnt get displayed in the table even though a print of the rowcount
displays the no of rows as 2
why is the second row not getting displayed in the table?
here is the code:-
Vector tabledata = new Vector();
tabledata.addElement(dbv);
try {
odbtable.refresh(tabledata);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//set up column properties
for ( int i = 1; i <= numberOfColumns; i++ ) {
Column c;
c = odbtable.getColumn(i-1);
try {
c.setHeaderValue(metaData.getColumnName( i ));
c.setType(metaData.getColumnType(i));
c.setReadOnly(true);
c.setPreferredWidth(100);
System.out.printf( "%-8s\t", metaData.getColumnName( i ) );
System.out.println();
System.out.printf( "%-8s\t", metaData.getColumnType( i ) );
System.out.println();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}//end for
//insert a non-db row
//odbtable.setEditable(true);
Vector ndbv = new Vector();
ndbv.addElement(new String("MNO"));
ndbv.addElement(new String("PQR"));
ndbv.addElement(new String(""));
ndbv.addElement(new String(""));
odbtable.insert(ndbv);
System.out.println("NO OF ROWS" + odbtable.getRowCount());// displays 2
Thanks in advance