Skip to content

Commit 23bec4b

Browse files
authored
Handle boxes with no type. (#443)
Show the box's index instead of "undefined" (regression from commit 92eb110).
1 parent 8cf82b0 commit 23bec4b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/ui-helper.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,16 @@ function createFancyTree(parent, fileobj) {
241241
fancytree_options.renderTitle = function(event, data) {
242242
var box = data.node.data.box;
243243
var el = "<span class='fancytree-title'>";
244-
el += box.type + '&nbsp;';
244+
var title = box.type;
245+
if (!title) {
246+
// Find index in parent.
247+
var siblings = data.node.parent.children;
248+
for (var idx = 0; idx < siblings.length; idx++) {
249+
if (siblings[idx] == data.node) break;
250+
}
251+
title = idx;
252+
}
253+
el += title + '&nbsp;';
245254
if (box.box_name)
246255
el += "<span class='boxname'>(" + box.box_name + ")</span>";
247256
el += "</span>";

0 commit comments

Comments
 (0)