فهرست منبع

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

Moved logic to the datatables draw callback
Enrico Berti 11 سال پیش
والد
کامیت
ca76305d79
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": [
         {