Reputation: 7426
I want to create a mouse over event on the column of a GWT celltable. Can you help me?
Upvotes: 6
Views: 6067
Reputation: 41
I assume one would want 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 the table uses for the entire row.
Upvotes: 4
Reputation: 853
If you mean CellTable, you can try something like that...
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 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();
}
Upvotes: 9