Enhancement
Major
Detail
Major
Detail
In the following situation a javascript error occurs:
Two tables X` and `Y are visible. Y is a tree table that is defined as a drop target.
Now there is an event that causes X` to change the selection and `Y to change the expand state of a node.
Then there is the javascript error:
2021-03-30 10:50:15,149 ERROR [qtp1638335699-46]: base.services.simpleajax.AJAXServlet$AJAXLogHandler - Client-side message: Uncaught JavaScript exception (exception: 'TypeError: nodesArray is null', component: 'masterFrame', source: 'http://localhost:8080/pvm/servlet/LayoutServlet/w19502b3c85120aaa-f8697ac5a0fdad1', layout: 'masterFrame.xml', session: node01330x7z95lzb618k37obsjewrs2, UserAgent [Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0])
Cause
The tree table Y redraws itself as the unfold state of a node is changed.
Y` is drop-target, therefore the HTML-dom-parent `D of the table is a DIV without ID (the tl:ContentRenderer writes an anonymous DIV) which is re-layouted.
Because X also has an update there are 2 nodes that need to be re-layouted.
Now there is javascript code that analyzes the set of nodes M` to layout to layout only nodes that have no inner nodes to layout. This is done by looking if there is a DOM ancestor in M` for a node in `M`. This is done by looking if there is a node in `M with the same ID for an ancestor.
M` contains the anonymous DIV (without ID) `D written by the tl:ContentRenderer. Of course there is a predecessor of this DIV with the same, namely no, ID. The algorithm thinks there is an ancestor in M` and ignores `D. All other nodes to layout are also considered by the algorithm as children of `D`, so they are ignored.
The consequence is that (supposedly) no nodes have to be laid out. Now a bug in the LinkedHashMap (in JS) strikes which says: The values of an empty map are null. So a null access takes place.
Test
- An automatic test is not possible, because the problem is in the JavaScript code.
- Since the problem can otherwise only be reproduced with additional views, which are not technically useful, a patch must be applied.
- Apply the following patch:
{{#!patch ### Eclipse Workspace Patch 1.0 #P com.top_logic Index: src/com/top_logic/layout/layoutRenderer/ContentRenderer.java =================================================================== --- src/com/top_logic/layout/layoutRenderer/ContentRenderer.java (revision 307602) +++ src/com/top_logic/layout/layoutRenderer/ContentRenderer.java (working copy) @@ -94,7 +94,7 @@ businessComponent.writeDebugHeader(out); }
- if (dropEnabled(contentControl)) {
+ if (true || dropEnabled(contentControl)) { out.beginBeginTag(DIV); out.beginCssClasses(); out.append("lcViewport"); }}
- In the demo in the DemoTypes structure under the root node have two nodes generated.
- Go to the following view: Technical Demo > Layout Framework#1 > Forms > In-App Drag and Drop.
- In the TreeGrid expand the first of the generated nodes and drag the A1 into the TreeTable onto the second generated node.
- No error must be logged.
- All displayed views must look correct.
- In particular, the footer must be displayed at the bottom of all displayed tables and not somewhere in the upper right corner directly below the table header next to the column contents.