gwt中datagrid列的工具提示

时间:2015-09-15 05:45:46

标签: gwt datagrid

** datagrid上的工具提示列只是将此代码放在构造函数**

T = model class;  

dataGrid.addCellPreviewHandler(new CellPreviewEvent.Handler<T>() {

                @Override
                public void onCellPreview(final CellPreviewEvent<T> event) {
                    if ("mouseover".equals(event.getNativeEvent().getType())) {
                        String str = "";
                        Element cellElement = event.getNativeEvent()
                        .getEventTarget().cast();
                        int row = event.getIndex();
                        int col = event.getColumn();
                        T model = (T) dataGrid
                        .getVisibleItem(row);
                        str = "" + dataGrid.getColumn(col).getValue(model);
                        cellElement.setTitle(str);

                    }
                }
            });

0 个答案:

没有答案