Giving the delete button a hover tooltip in gwt

2019-08-28 05:50发布

In this picture, as you can see there are the red deletion buttons, how do I create a hover tooltip for these buttons? Is it the same as setShowHover(true)?

enter image description here

Code:

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?

标签: gwt smartgwt
1条回答
\"骚年 ilove
2楼-- · 2019-08-28 05:55

Yes you can do it by using setHoverCustomizer() method on ListGridField.

Here is the code:

    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";
        }
    });
查看更多
登录 后发表回答