在此图片中,您可以看到有红色删除按钮,如何为这些按钮创建悬停工具提示?它与setShowHover(true)
相同吗?
代码:
HoverCustomizer customGroupTooltips = new HoverCustomizer()
{
@Override
public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
if (colNum == 1)
{
return "tooltip message";
}
else if (colNum == 2)
{
return "delete";
}
return null;
}
};
ListGridField name = new ListGridField(FIELD_NAME);
ListGridField exportField = new IconField(FIELD_EXPORT, ICON.jpg, EXPORT_CUSTOM);
exportField.setShowHover(true);
exportField.setHoverCustomizer(customGroupTooltips.hoverHTML()); //how do i make sure it is colNum 1 message here?
答案 0 :(得分:1)
是的,您可以使用setHoverCustomizer()
上的ListGridField
方法来执行此操作。
以下是代码:
ListGrid grid = new ListGrid();
grid.setCanHover(true);
grid.setShowHover(true);
...
grid.setCanRemoveRecords(true);
ListGridField ls = new ListGridField();
grid.setRemoveFieldProperties(ls);
ls.setHoverCustomizer(new HoverCustomizer() {
@Override
public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
return "click here to delete this record";
}
});