Bladeren bron

HUE-2157 [search] Update Gridlayout field list on search

Fixed for layout change case
Enrico Berti 11 jaren geleden
bovenliggende
commit
3f27c55
2 gewijzigde bestanden met toevoegingen van 14 en 4 verwijderingen
  1. 12 4
      apps/search/src/search/templates/search.mako
  2. 2 0
      apps/search/static/js/search.ko.js

+ 12 - 4
apps/search/src/search/templates/search.mako

@@ -1207,10 +1207,13 @@ function toggleDocDetails(doc) {
 
 function resizeFieldsList() {
   $(".fields-list").css("max-height", Math.max($("#result-container").height(), 230));
-  var _fillHeight = $("#result-container").height() - 40;
-  if ($(".fields-list").height() < _fillHeight) {
-    $(".fields-list").height(_fillHeight);
-  }
+  window.setTimeout(function () {
+    var _fillHeight = $("#result-container").height() - 40;
+    if ($(".fields-list").height() < _fillHeight) {
+      $(".fields-list").height(_fillHeight);
+      $(".fields-list").css("max-height", _fillHeight);
+    }
+  }, 100);
 }
 
 $(document).ready(function () {
@@ -1258,6 +1261,10 @@ $(document).ready(function () {
     resizeFieldsList();
   });
 
+  $(document).on("setLayout", function(){
+    resizeFieldsList();
+  });
+
   ko.bindingHandlers.slideVisible = {
     init: function (element, valueAccessor) {
       var value = valueAccessor();
@@ -2000,6 +2007,7 @@ $(document).ready(function () {
 
   $(document).on("setResultsHeight", function () {
     $("#result-main").height($("#result-container").outerHeight() + 100);
+    resizeFieldsList();
   });
 
   function highlightColumn(column) {

+ 2 - 0
apps/search/static/js/search.ko.js

@@ -177,6 +177,8 @@ function setLayout(colSizes) {
   });
 
   viewModel.columns(_cols);
+
+  $(document).trigger("setLayout");
 }
 
 function loadLayout(viewModel, json_layout) {