瀏覽代碼

HUE-6653 [frontend] Make sure the foreachVisible binding updates visible entries in case the size changes

Johan Ahlen 8 年之前
父節點
當前提交
2807e8a
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

+ 9 - 0
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -4906,16 +4906,25 @@
           return;
         }
         var diff = false;
+        var updateEntryCount = false;
         $.each(renderedElements, function (idx, renderedElement) {
           // TODO: Figure out why it goes over index at the end scroll position
           if (startIndex + idx < lastKnownHeights.length) {
             var renderedHeight = $(renderedElement).outerHeight(true);
             if (renderedHeight > 5 && lastKnownHeights[startIndex + idx] !== renderedHeight) {
+              if (renderedHeight < entryMinHeight) {
+                entryMinHeight = renderedHeight;
+                updateEntryCount = true;
+              }
               lastKnownHeights[startIndex + idx] = renderedHeight;
               diff = true;
             }
           }
         });
+
+        if (updateEntryCount) {
+          updateVisibleEntryCount();
+        }
         // Only resize if a difference in height was noticed.
         if (diff) {
           $parentFVOwnerElement.data('lastKnownHeights', lastKnownHeights);