Mouse event over a GWT table column

I want to create a mouse over an event in a column of a GWT table. Can you help me?

+6
source share
2 answers

If you mean CellTable, you can try something like this ...

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 } } }); 

UDP: method for getting the cell value.

 private String getElementValue( Element element) { Element child = element.getFirstChildElement().cast(); while (child != null) { element = child; child = element.getFirstChildElement().cast(); } return element.getFirstChild().getNodeValue(); } 
+9
source

I assume that I would like to get the data model (or object) associated with the column, you can simply call

 event.getValue() 

This returns the column data model, which is actually the model used by the table for the entire row.

+4
source

Source: https://habr.com/ru/post/899590/


All Articles