HI Isomorphic ,
I am using a ListGridEditorCustomizer to customize the cell editor for a field similar to here.
If an invalid value is entered in the cell editor, the cell displays an an error as expected; however, the cell error is cleared when tabbing to the next row.
I have put together the following simple test case to illustrate this issue.
After entering an invalid integer value for Item 2, the cell error is displayed as expected.
However, after tabbing to Item 3, the cell error is cleared.
If I remove the Clear Field, the cell errors are preserved so I'm not sure if this is a defect or just a limitation of the ListGridEditorCustomizer when the ListGrid has more than one editable field.
SmartClient Version: v12.1p_2022-01-20/Pro Deployment (built 2022-01-20)
Thanks.
I am using a ListGridEditorCustomizer to customize the cell editor for a field similar to here.
If an invalid value is entered in the cell editor, the cell displays an an error as expected; however, the cell error is cleared when tabbing to the next row.
I have put together the following simple test case to illustrate this issue.
Code:
public void onModuleLoad() { final ListGrid grid = new ListGrid(); grid.setWidth(400); grid.setHeight(300); grid.setCanEdit(Boolean.TRUE); grid.setEditEvent(ListGridEditEvent.CLICK); grid.setEditByCell(Boolean.TRUE); grid.setAutoSaveEdits(false); ListGridField nameField = new ListGridField("name", "Name"); nameField.setWidth("*"); nameField.setCanEdit(false); ListGridField valueField = new ListGridField("value", "Value Field", 170); ListGridField clearField = new ListGridField("clear", "Clear Field"); clearField.setType(ListGridFieldType.BOOLEAN); clearField.setAlign(Alignment.CENTER); grid.setFields(nameField, valueField, clearField); grid.setData(getData()); grid.setEditorCustomizer(context -> { ListGridField field = context.getEditField(); if (field.getName().equals("value")) { return new IntegerItem(); } return context.getDefaultProperties(); }); grid.draw(); } private ListGridRecord[] getData() { return new ListGridRecord[] { new NameValueRecord(1, "Item 1", 5), new NameValueRecord(2, "Item 2", 10), new NameValueRecord(3, "Item 3", 15) }; } public static class NameValueRecord extends ListGridRecord { public NameValueRecord(int id, String name, Object value) { setID(id); setName(name); setValue(value); } public void setID(int id) { setAttribute("ID", id); } public int getID() { return getAttributeAsInt("ID"); } public void setValue(Object value) { setAttribute("value", value); } public Object getValue() { return getAttributeAsObject("value"); } public void setName(String name) { setAttribute("name", name); } public String getName() { return getAttribute("name"); } }
However, after tabbing to Item 3, the cell error is cleared.
If I remove the Clear Field, the cell errors are preserved so I'm not sure if this is a defect or just a limitation of the ListGridEditorCustomizer when the ListGrid has more than one editable field.
SmartClient Version: v12.1p_2022-01-20/Pro Deployment (built 2022-01-20)
Thanks.
Comment