我是GWT
的新手。我将dataGrid与许多“EditTextCell
”列集成在一起。每列都有一个“FieldUpdater
”,用于更新数据库中的值。
我的问题是,每次进入任何单元格(字段),但不执行任何操作(我在字段中保持相同的值),“FieldUpdater.update()
”触发方法并对数据库执行UPDATE。
是否存在阻止更新的“最佳做法”?
答案 0 :(得分:1)
将旧值与新值进行比较,并仅在值不同时触发事件
column.setFieldUpdater(new FieldUpdater<Row, String>()
{
public void update(int index, Row row, String value)
{
Object oldValue = row.getCellValue(code);
//if value is different than oldValue
//then fire event
}
});