瀏覽代碼

HUE-6422 [editor] Bar Charts can be messy when user toggles the 'columns <' icon

Enrico Berti 8 年之前
父節點
當前提交
753a547
共有 1 個文件被更改,包括 10 次插入1 次删除
  1. 10 1
      desktop/libs/notebook/src/notebook/templates/editor_components.mako

+ 10 - 1
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -1798,7 +1798,7 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
     </div>
 
     <div>
-      <a class="snippet-side-btn" href="javascript:void(0)" data-bind="click: function(){ isResultSettingsVisible(! isResultSettingsVisible()) }, css: { 'blue' : isResultSettingsVisible }" title="${ _('Columns') }">
+      <a class="snippet-side-btn" href="javascript:void(0)" data-bind="click: function(){ huePubSub.publish('chart.hard.reset'); isResultSettingsVisible(! isResultSettingsVisible()) }, css: { 'blue' : isResultSettingsVisible }" title="${ _('Columns') }">
         <!-- ko if: isResultSettingsVisible() -->
         <i class="fa fa-fw fa-chevron-left"></i>
         <!-- /ko -->
@@ -2174,6 +2174,15 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
       }
     });
 
+    huePubSub.subscribeOnce('chart.hard.reset', function(){
+      // hard reset once the default opened chart
+      var oldChartX = snippet.chartX();
+      snippet.chartX(null);
+      window.setTimeout(function(){
+        snippet.chartX(oldChartX);
+      }, 0)
+    });
+
     return _dt;
   }