Forráskód Böngészése

HUE-8132 [dashboard] Fix the page rendering on IE11 and Edge

Enrico Berti 7 éve
szülő
commit
bbeb345

+ 8 - 4
desktop/libs/dashboard/src/dashboard/templates/common_search.mako

@@ -4076,11 +4076,15 @@ $(document).ready(function () {
     }
   }
 
-  var widgetGridWidth = parseInt(hueUtils.getStyleFromCSSClass('[data-sizex="1"]').width);
+  var widgetGridWidth = null;
 
-  huePubSub.subscribe('dashboard.window.resize', function () {
-    widgetGridWidth = parseInt(hueUtils.getStyleFromCSSClass('[data-sizex="1"]').width);
-  }, 'dashboard');
+  var setWidgetGridWidth = function () {
+    // turns out Gridster generates CSS either with single or double quotes depending on the browser
+    widgetGridWidth = typeof hueUtils.getStyleFromCSSClass('[data-sizex="1"]') !== 'undefined' ? parseInt(hueUtils.getStyleFromCSSClass('[data-sizex="1"]').width) : parseInt(hueUtils.getStyleFromCSSClass("[data-sizex='1']").width);
+  }
+
+  setWidgetGridWidth();
+  huePubSub.subscribe('dashboard.window.resize', setWidgetGridWidth, 'dashboard');
 
   function restoreWidgetSizes() {
     $('li.gs-w').each(function () {