单元格上的工具提示。 GWT

时间:2011-12-29 13:01:11

标签: java gwt

我使用纯GWT。我如何为每个单元格实现动态的不同工具提示。或者如果难以实现,如何为ev​​eery ROW实现不同的工具提示? 感谢

1 个答案:

答案 0 :(得分:1)

你可以看一下它的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);