我有以下ButtonCell。如何让它响应点击(例如addClickHandler)?我尝试了很多方法,但我找不到任何方法。没有Window.alert返回响应。
ButtonCell selectButton = new ButtonCell();
Column <HikingMeals,String> update = new Column <HikingMeals,String>(selectButton){
@Override
public String getValue(HikingMeals selectButton)
{
return "Select";
}
public void execute(HikingMeals selectButton) {
// EDIT CODE
Window.alert("Pressed");
}
//@Override
public void update(int index, HikingMeals object, String value) {
// The user clicked on the button for the passed auction.
Window.alert("Pressed2");
}
};
table.addColumn(update, "Select");
答案 0 :(得分:2)
您只需在FieldUpdater
列上设置update
:
update.setFieldUpdater(new FieldUpdater<HikingMeals, String>() {
@Override
public void update(int index, HikingMeals object, String value) {
Window.alert("Pressed");
}
});