diff --git a/scripted/src/scripts/ui/views/ordered-view-frame.js b/scripted/src/scripts/ui/views/ordered-view-frame.js index 67fc01f..e68be49 100644 --- a/scripted/src/scripts/ui/views/ordered-view-frame.js +++ b/scripted/src/scripts/ui/views/ordered-view-frame.js @@ -351,16 +351,31 @@ Exhibit.OrderedViewFrame.prototype._internalReconstruct = function(allItems) { processNonNumericLevel(items, index, values, valueType) : processNumericLevel(items, index, values, valueType); + grouped = true; + // The idea here appears to be to avoid considering a set of + // one item a group; but this ends up producing very confusing + // grouping with ordering - a single-item set without a group + // has no label and subsequent sibling entities (items or groups) then + // end up appearing as children instead, depending on position + // relative to the end of the supergroup. The current solution: + // consider single items a group. Comments labelled mono-grouping + // optimize this choice. Consider revisiting it in the future, + // possibly as a setting. + /** mono-grouping grouped = false; for (k = 0; k < keys.length; k++) { if (keys[k].items.size() > 1) { grouped = true; } } + */ + hasSomeGrouping = true; + /** mono-grouping if (grouped) { hasSomeGrouping = true; } + */ for (k = 0; k < keys.length; k++) { key = keys[k]; diff --git a/scripted/src/scripts/ui/views/thumbnail-view.js b/scripted/src/scripts/ui/views/thumbnail-view.js index 85f3e97..4ba3c96 100644 --- a/scripted/src/scripts/ui/views/thumbnail-view.js +++ b/scripted/src/scripts/ui/views/thumbnail-view.js @@ -226,7 +226,7 @@ Exhibit.ThumbnailView.prototype._reconstructWithFloats = function() { state.groupDoms = state.groupDoms.slice(0, groupLevel); state.groupCounts = state.groupCounts.slice(0, groupLevel); - if (groupLevel > 0 && groupLevel <= state.groupDoms.length) { + if (groupLevel > 0) { state.div = state.groupDoms[groupLevel - 1].contentDiv; } else { state.div = view._dom.bodyDiv; @@ -292,7 +292,7 @@ Exhibit.ThumbnailView.prototype._reconstructWithTable = function() { closeGroups = function(groupLevel) { var i; for (i = groupLevel; i < state.groupDoms.length; i++) { - state.groupDoms[i].countSpan.innerHTML = state.groupCounts[i]; + Exhibit.jQuery(state.groupDoms[i].countSpan).html(state.groupCounts[i]); } state.groupDoms = state.groupDoms.slice(0, groupLevel); state.groupCounts = state.groupCounts.slice(0, groupLevel); @@ -308,7 +308,6 @@ Exhibit.ThumbnailView.prototype._reconstructWithTable = function() { }; this._orderedViewFrame.onNewGroup = function(groupSortKey, keyType, groupLevel) { - // @@@ this may not be algorithmically correct closeGroups(groupLevel); var groupDom = Exhibit.ThumbnailView.constructGroup( @@ -427,28 +426,28 @@ Exhibit.ThumbnailView.prototype.stateDiffers = function(state) { */ Exhibit.ThumbnailView.constructGroup = function(groupLevel, label) { var template = { - tag: "div", + "tag": "div", "class": "exhibit-thumbnailView-group", - children: [ - { tag: "h" + (groupLevel + 1), - children: [ + "children": [ + { "tag": "h" + (groupLevel + 1), + "children": [ label, - { tag: "span", + { "tag": "span", "class": "exhibit-collectionView-group-count", - children: [ + "children": [ " (", - { tag: "span", - field: "countSpan" + { "tag": "span", + "field": "countSpan" }, ")" ] } ], - field: "header" + "field": "header" }, - { tag: "div", + { "tag": "div", "class": "exhibit-collectionView-group-content", - field: "contentDiv" + "field": "contentDiv" } ] };