本文介绍了给gwt中的删除按钮悬停工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这幅图中,你可以看到有红色的删除按钮,我如何为这些按钮创建一个悬停工具提示?它是否与 setShowHover(true)相同?

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)?

代码:

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?


推荐答案

是的,您可以使用 setHoverCustomizer()方法位于 ListGridField

Yes you can do it by using setHoverCustomizer() method on 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";
        }
    });

这篇关于给gwt中的删除按钮悬停工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 04:49