我有一个包含 CheckboxCell 的 CellTable。
我已向其中添加了以下处理程序:
private static Column<AIDataRecord, Boolean> m_checkColumn =
new Column<AIDataRecord, Boolean>(new CheckboxCell(true, false))
{
@Override
public Boolean getValue(AIDataRecord object)
{
// Get the value from the selection model.
return object.isSelected();
}
@Override
public void onBrowserEvent(Context context, Element elem, AIDataRecord object, NativeEvent event)
{
System.out.println("Browser Event Called");
super.onBrowserEvent(context, elem, object, event);
String eventType = event.getType();
if ("change".equals(eventType))
{
System.out.println("Value changed");
object.toggleSelection();
System.out.println("Nw : "+object.isSelected());
}
}
};
其中 object.toggleSelection()
是一种反转 boolean 字段的方法,即 true 为 false 和 false 为 true。
我使用此代码查找是否选中了任何复选框或不识别任何行。
这个东西在除 IE 8 之外的所有主要浏览器中都运行得很好。
在 IE 8 中,我得到了 object.isSelected() true,但当我单击该面板上的按钮删除行时,它显示同一行的 isSelected() false。
任何人都可以帮我解决我应该在哪里找到问题吗?为什么 IE 的行为不同?
任何 Java/GWT 专家都可以帮我吗...
谢谢。
最佳答案
为什么不为您的列分配 FieldUpdater?这要简单得多。例如:
m_checkColumn.setFieldUpdater(
new FieldUpdater<AIDataRecord, Boolean>() {
@Override
public void update(int index, AIDataRecord object, Boolean value) {
object.toggleSelection();
Window.alert("Nw : " + object.isSelected());
}
}
);
关于java - GWT CellTable CheckboxCell 在 IE8 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11666240/