I need to set edit value in list grid from existing value to null in numeric field. Edits come from external component and must be reflected on the grid. Filed is not required so it can have null value. I was trying the following:
1) throws an exception
Integer nullValue = null;
listGrid.setEditValue(rowNum, fieldName, nullValue);
2) look like this is working the same as clearEditValue(rowNum, "fieldName")
HashMap map = new HashMap<>();
map.put("fieldName", null);
listGrid.setEditValues(rowNum, map);
I'm using SmartGWT 6.0p
I'm able to set a cell of a Integer
field to null
in a ListGrid
with the following code
public void setCellValue(int rowNum, String nameOfField, ListGrid listgrid) {
ListGridRecord row = listgrid.getRecord(rowNum);
Integer intNull = null;
row.setAttribute(nameOfField, intNull);
listgrid.updateData(row);
}
After setCellValue was called, the corresponding cell correctly changed to blank.
Found solution. Regardless of filed type I can cast null to String In this case SmartGWT is not throwing any exception and edit value is set to null
listGrid.setEditValue(rowNum, fieldName (String)null);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.