浏览代码

HUE-2389 [impala] Expand results table after the results are added to datatables

Moved logic to the datatables draw callback
Enrico Berti 11 年之前
父节点
当前提交
ca76305
共有 1 个文件被更改,包括 9 次插入3 次删除
  1. 9 3
      apps/beeswax/src/beeswax/templates/execute.mako

+ 9 - 3
apps/beeswax/src/beeswax/templates/execute.mako

@@ -1916,7 +1916,12 @@ function addRowNumberToResults(data, startIndex) {
   return _tmpdata;
 }
 
+var firstFnDrawcallback = false;
+
 function addResults(viewModel, dataTable, index, pageSize) {
+  if (index == 0) {
+    firstFnDrawcallback = true;
+  }
   if (viewModel.hasMoreResults() && index + pageSize > viewModel.design.results.rows().length) {
     $(document).one('fetched.results', function () {
       $.totalStorage(hac_getTotalStorageUserPrefix() + "${app_name}_temp_query", null);
@@ -1926,9 +1931,6 @@ function addResults(viewModel, dataTable, index, pageSize) {
   } else {
     dataTable.fnAddData(addRowNumberToResults(viewModel.design.results.rows.slice(index, index + pageSize), index));
   }
-  if (index == 0){
-    window.setTimeout(reinitializeTable, 500);
-  }
 }
 
 function resultsTable(e, data) {
@@ -1945,6 +1947,10 @@ function resultsTable(e, data) {
       },
       "fnDrawCallback": function (oSettings) {
         reinitializeTableExtenders();
+        if (firstFnDrawcallback) {
+          firstFnDrawcallback = false;
+          window.setTimeout(reinitializeTable, 100);
+        }
       },
       "aoColumnDefs": [
         {