Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GWT celltable列上的鼠标悬停事件_Gwt - Fatal编程技术网

GWT celltable列上的鼠标悬停事件

GWT celltable列上的鼠标悬停事件,gwt,Gwt,我想在GWT celltable的列上创建鼠标悬停事件。你能帮帮我吗?如果你是指手机桌,你可以试试这样的东西 table.addCellPreviewHandler(new Handler<IdObject>() { @Override public void onCellPreview( CellPreviewEvent<IdObject> event) { if

我想在GWT celltable的列上创建鼠标悬停事件。你能帮帮我吗?

如果你是指手机桌,你可以试试这样的东西

table.addCellPreviewHandler(new Handler<IdObject>()
    {

        @Override
        public void onCellPreview(
            CellPreviewEvent<IdObject> event)
        {
            if ("mouseover".equals(event.getNativeEvent().getType())) {
                Element cellElement = event.getNativeEvent().getEventTarget().cast();
                // play with element
            }
        }
    });

我假设您想要获得与列关联的数据模型(或对象),您只需调用

event.getValue()

这将返回列数据模型,这实际上是表用于整行的模型。

Hi globerz,非常感谢。它可以工作,但我不知道如何设置一个特定的列。例如,我需要鼠标悬停在celltable第6列的事件上。你能帮帮我吗?提前感谢,GnikCellPreviewEvent有int方法getColumn:)您好globerz,非常感谢。它起作用了。但我有个问题。我需要得到我在鼠标上方的列的数据。我正在尝试。如果你知道的话。请帮帮我。提前感谢,只需将鼠标移到列上,也可以移到特定行的其他列上。谢谢,所以。。您可以获取行的对象(对象=table.getVisibleItem(event.getindex())并在表(table.getColumn(event.getColumn()).getValue(object))中计算其值。它适合吗?+)
event.getValue()