SmartGWT:以编程方式将列表网格中的编辑值设置为数字字段的空值

SmartGWT: Programmatically set edit value in list grid to null for numeric field

我需要将列表网格中的编辑值从现有值设置为数字字段中的空值。编辑来自外部组件,必须反映在网格上。不需要归档,因此它可以具有空值。 我正在尝试以下操作:

1) 抛出异常

Integer nullValue = null;
listGrid.setEditValue(rowNum, fieldName, nullValue);

2) 看起来这与 clearEditValue(rowNum, "fieldName")

的工作方式相同
HashMap map = new HashMap<>();
map.put("fieldName", null);
listGrid.setEditValues(rowNum, map);

我正在使用 SmartGWT 6.0p

我可以使用以下代码将 Integer 字段的单元格设置为 ListGrid 中的 null

public void setCellValue(int rowNum, String nameOfField, ListGrid listgrid) {
   ListGridRecord row = listgrid.getRecord(rowNum);
   Integer intNull = null;
   row.setAttribute(nameOfField, intNull);
   listgrid.updateData(row);
}

调用setCellValue后,相应单元格正确变为空白。

找到解决方案。无论归档类型如何,我都可以将 null 转换为 String 在这种情况下,SmartGWT 没有抛出任何异常,编辑值设置为 null

listGrid.setEditValue(rowNum, fieldName (String)null);