我使用纯GWT。我如何为每个单元实现动态的不同工具提示。或者,如果难以实现,如何为eveery ROW实现不同的工具提示?
谢谢
最佳答案
您可以看看它的very good example。
ListGridField nameField = new ListGridField("countryName", "Country");
ListGridField governmentField = new ListGridField("government", "Government", 120);
governmentField.setShowHover(true);
governmentField.setHoverCustomizer(new HoverCustomizer() {
public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
CountryRecord countryRecord = (CountryRecord) record;
int governmentDesc = countryRecord.getGovernmentDesc();
String[] governmentDescription = new String[]{
//your data see link for more detail""
};
return governmentDescription[governmentDesc];
}
});
countryGrid.setFields(countryCodeField, nameField, governmentField);
countryGrid.setCanResizeFields(true);
countryGrid.setData(CountryData.getRecords());
canvas.addChild(countryGrid);