Reputation: 535
I get the list of results using rpc call. I sure that result list is correct because when I use dialog box all data is there. But when I put it in CellTable some rows lost. Why does this happen?
public void onSuccess(List<List<String>> result) {
CellTable<List<String>> bugsTable = new CellTable<List<String>>();
// Create columns
TextColumn<List<String>> idColumn = new TextColumn<List<String>>() {
@Override
public String getValue(List<String> recordSet) {
return recordSet.get(0).toString();
}
};
TextColumn<List<String>> idCommitColumn = new TextColumn<List<String>>() {
@Override
public String getValue(List<String> recordSet) {
return recordSet.get(1).toString();
}
};
TextColumn<List<String>> erMessageColumn = new TextColumn<List<String>>() {
@Override
public String getValue(List<String> recordSet) {
return recordSet.get(2).toString();
}
};
// Add the columns.
bugsTable.addColumn(idColumn, "ID");
bugsTable.addColumn(idCommitColumn, "ID commit");
bugsTable.addColumn(erMessageColumn, "Message");
// Set the total row count. This isn't strictly necessary, but it affects
// paging calculations, so its good habit to keep the row count up to date.
bugsTable.setRowCount(result.size(), true);
// Push the data into the widget.
bugsTable.setRowData(0, result);
tabP.add(bugsTable, "bugs");
RootPanel.get("loadingbarImg").setVisible(false);
}
});
Upvotes: 0
Views: 112
Reputation: 64541
The default ProvidesKey
(SimpleKeyProvider
) uses objects themselves as keys, so their equals()
and hashCode()
are used. The java.util.List
contract defines the equals()
and hashCode()
behaviors, and mandates that two lists with the same items will be equals()
and have the same hashCode()
, so if you have some identical rows in your list, it could be a problem.
Solution: don't use List<String>
for your rows, define a specific row class instead.
Upvotes: 2