I am stuck in a problem with GWT CellTable. I need to create celltable dynamically and I dont have entity (Bean) class to do so. I have seen all the examples of celltable and searched a lot to do so without entity class.
I need to populate table dynamically according to some metadata stored in database. I am able create table structure
Consider there are two classes one is GRID and another is COLUMN for the metadata and columns definition. GRID will have list of COLUMNS as a columns definition
Class GRID {
List<COLUMN> columns;
}
Class COLUMN {
String columnName;
}
Now i need to get grid from database and loop the columns to populate the cells (Columns) like :
com.google.gwt.user.cellview.client.Column<String, String> textColumn = new Column<String, String>(
new EditTextCell()) {
@Override
public String getValue(String object) {
return object;
}
};
Now, I need to add some data to the celltable. but without entity there are no example how to populate the different columns. I have tried my self like : (Consider Grid have 3 columns)
List<String> data;
String a1 = "A1";
String a2 = "A2";
String a3 = "A3";
data = new ArrayList<String>();
data.add(a1);
data.add(a2);
data.add(a3);
final AsyncDataProvider<String> provider = new AsyncDataProvider<String>() {
@Override
protected void onRangeChanged(HasData<String> display) {
updateRowData(0, data);
}
};
provider.addDataDisplay(grid);
provider.updateRowCount(data.size(), true);
I am able to produce the output like :
A1 A1 A1
A2 A2 A2
A3 A3 A3
Actually output should be one row only like
A1 A2 A3
But failed to do so.
Please help.
Thankx,
Regards,
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…