Investigated a little bit and tried other models. If i am using a
SortableModel made with an ArrayDataModel with Customers supplied
statically in the Code it works, t:dataTable shows what i want to see.
But if i am going to use a SortableModel from a ResultSetDataModel to
get the Customers from a database table, only h:dataTable still works,
t:dataTable shows nothing.
Any things with this Model type to get it working with tomahawk extended
Table?
code which works with the tomahawk dataTable:
...
private Customer[] customers = {
new Customer("1","Anna","034142","My
Street","Leipzig","Sachsen"),
new Customer("2","Bert","014142","Ny
Street","Halle","Sachsen-Anhalt"),
};
public TableData() {
...
ArrayDataModel ar_model = new ArrayDataModel(customers);
filterModel = new SortableModel(ar_model);
...
}
code which doesnt work with tomahawks dataTable, but with the default
one:
public TableData() {
open();
Statement stmt = conn
.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet result = stmt.executeQuery("SELECT * FROM
Customers");
CachedRowSetImpl crs = new CachedRowSetImpl();
crs.populate(result);
ResultSetDataModel db_model = new
ResultSetDataModel(crs.getOriginal());
filterModel = new SortableModel(db_model);
close();
}
The database table was made with this sql script:
CREATE TABLE Customers (
Cust_ID INT,
Name CHAR(30),
Phone_Number CHAR(15),
Street_Address CHAR(30),
City CHAR(30),
State CHAR(15)
);
INSERT INTO Customers VALUES (1, 'William Dupont', '(652)488-9931',
'801 Oak Street', 'Eugene', 'Nebraska');
INSERT INTO Customers VALUES (2, 'Anna Keeney', '(716)834-8772',
'86 East Amherst Street', 'Buffalo', 'New York');
INSERT INTO Customers VALUES (3, 'Mariko Randor', '(451)842-8933',
'923 Maple Street', 'Springfield', 'Tennessee');
Some hints would be nice.
kind regards
Torsten