JSP - Dynamic Table Data
Hi all.
I have this problem for some time now. I need to show data as soon as I retrieve it from database. The code I'm using is as follows:
privateboolean constructUiDynamically(){
Table table=null;
TableRowGroup rowGroup=null;
TableColumn tableColumn1=null; String column1Header ="ISSUER ID";
Label aLabel=new Label(); aLabel.setVisible(true);
aLabel.setStyle("heigth: 100%; width: 100%");
TableColumn tableColumn2=null; String column2Header ="ISSUER BIN";
TextField aTextField =new TextField(); aTextField.setVisible(true);
aTextField.setStyle("heigth: 100%; width: 100%");
IssuerTableDataProvider itdp =null;
Button commitButton =null;
Button undoButton=null;
Bankbank=null;
String bid=null;
String bname=null;
Vector issuers=null;
String iid=null;
String ibins=null;
String tableTitle =null;
int numOfIssuers = -1;
int numOfBanks= this.bankInstances.size();
for(int i=0; i<numOfBanks; i++){
// data
bank = (Bank) this.bankInstances.elementAt(i);
bid = bank.getBankId();
bname = bank.getBankName();
issuers = bank.getVIssuers();
// objects
table=new Table(); table.setTitle("Bank ID: " + bid +" Bank Name: " + bname); table.setVisible(true);
rowGroup=new TableRowGroup(); rowGroup.setVisible(true);
tableColumn1 =new TableColumn();tableColumn1.setHeaderText(column1Header);tableColumn1.setVisible(true);
tableColumn1.setStyle("height: 20px; width: 3px");
tableColumn2 =new TableColumn();tableColumn2.setHeaderText(column2Header);tableColumn2.setVisible(true);
tableColumn2.setStyle("height: 20px; width: 150px");
commitButton =new Button();commitButton.setText("Commit");commitButton.setVisible(true);
undoButton=new Button();undoButton.setText("Undo"); undoButton.setVisible(true);
// connect objects
rowGroup.getChildren().add(tableColumn1);
rowGroup.getChildren().add(tableColumn2);
table.getChildren().add(rowGroup);
tableColumn1.getChildren().add(aLabel);
tableColumn2.getChildren().add(aTextField);
this.getLayoutPanel1().getChildren().add(table);
this.getLayoutPanel1().getChildren().add(commitButton);
this.getLayoutPanel1().getChildren().add(undoButton);
this.getVColumn1().add(tableColumn1);
this.getVColumn2().add(tableColumn2);
this.getVRowGroups().add(rowGroup);
this.getVDataProvider().add(itdp);
this.getVTable().add(table);
this.getVCommitButtons().add(commitButton);
this.getVUndoButtons().add(undoButton);
// data provider fill up
numOfIssuers = issuers.size();
itdp =new IssuerTableDataProvider(numOfIssuers);
for(int j=0; j><numOfIssuers; j++){
iid= ((Issuer) issuers.elementAt(j)).getISSUER_ID();
ibins = ((Issuer) issuers.elementAt(j)).getLineOfBins();
itdp.setValue(j, iid, ibins);
}
rowGroup.setSourceData(itdp);
}
returntrue;
}
My data source object is a custom class that extends the ObjectArrayDataProvider. Everything seems to work perfectly except that no data are shown in the table. If I use my data source to manually request the data every thing is ok, but no data actually are printed in the table.
First of all, can I do this, or I must follow another approach?
Any help, please?>

