major
minor
major
minor
A JavaScript error occurs in the following situation:
Two tables, X` and `Y, are visible. Y is a tree table defined as a drop target.
Now there is an event that causes `X` to change the selection and `Y` to change the expanded state of a node.
This results in the following 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 is being redrawn because the expansion state of a node has changed.
`Y` is a drop target, so the HTML DOM parent `D` of the tableis a DIV without an ID (the `tl:ContentRenderer` inserts an anonymous DIV) that is being relayouted.
Because X also has an update, there are two nodes that need to be relayouted.
There is now JavaScript code that analyzes the set of nodes `M` to be laid out in order to layout only those nodes that do not have any inner nodes that need to be laid out. To do this, it checks whether a node in `M ` has a DOM ancestor in `M`. This is done by checking whether there is a node in `M` with the same ID as an ancestor.
` M` contains the anonymous DIV (without an ID) `D `, which was written by the `tl:ContentRenderer`. Of course, there is a parent of this DIV with the same ID—namely, none. The algorithm assumes there is an ancestor in `M` and ignores `D`. All other nodes to be laid out are also treated by the algorithm as children of `D` and are therefore ignored.
The result is that (supposedly) no nodes need to be laid out. Now, an error in the LinkedHashMap (in JS) occurs, stating: The values of an empty map are null. This results in a null access.
Test
- An automated test is not possible because the problem lies in the JavaScript code.
- Since the problem can otherwise only be reproduced using additional views—which are not technically feasible—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, generate two nodes under the root node in the DemoTypes structure.
- 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 element from the TreeGrid onto the second generated node in the TreeTable.
- No error should be logged.
- All displayed views must appear correct.
- In particular, the footer must be displayed at the bottom of all tables shown, and not somewhere in the upper-right corner directly below the table header next to the column contents.