Major
Detail
Detail
Problem
A new row is automatically selected as a transient object. If the object creation is canceled, the new row is discarded. The problem is that the row is discarded first and only then the associated selection is searched for and reset(GridComponent#dropRow()). The selection is not found at this time, so the row is removed, but the selection remains.
If in this state now the edit mode is changed and left again, the function dropRow(... ) is called with null via GridComponent#handleComponenteModeChange ( ), because no more row is found for the still existing selection. This leads to a NullPointerException.
If, on the other hand, another attempt is made to create a new object, the old "new object" is used as the context object, which also fails.
Solution
In the dropRow(...) method, first determine the affected rows, note them and then remove them. Then the selection can be reset for the affected rows.
Test
- TestDropGridRow.script.xml or
- Manually:
- In empty tree- tl:GridComponent create new object as new row.
- Expectation: The new row is displayed and selected.
- Do not save, but cancel directly.
- The new row disappears. There is no visible selection.
- Switch to edit mode.
- There is still no visible selection.
- Exit / cancel editing mode.
- Expectation: No NullPointerException occurs.
- In empty tree- tl:GridComponent create new object as new row.