Эх сурвалжийг харах

[beeswax] Number results row from 1 instead of 0 and set max width for the first column

Enrico Berti 10 жил өмнө
parent
commit
d2c1446

+ 2 - 2
apps/beeswax/src/beeswax/templates/execute.mako

@@ -417,7 +417,7 @@ ${ layout.menubar(section='query') }
               <table id="resultTable" class="table table-striped table-condensed" cellpadding="0" cellspacing="0" data-tablescroller-enforce-height="true">
                 <thead>
                 <tr data-bind="foreach: $root.design.results.columns">
-                  <th data-bind="html: ($index() == 0 ? '&nbsp;' : $data.name), css: { 'sort-numeric': isNumericColumn($data.type), 'sort-date': isDateTimeColumn($data.type), 'sort-string': isStringColumn($data.type)}"></th>
+                  <th data-bind="html: ($index() == 0 ? '&nbsp;' : $data.name), css: { 'sort-numeric': isNumericColumn($data.type), 'sort-date': isDateTimeColumn($data.type), 'sort-string': isStringColumn($data.type), 'datatables-counter-col': $index() == 0}"></th>
                 </tr>
                 </thead>
               </table>
@@ -1923,7 +1923,7 @@ function cleanResultsTable() {
 function addRowNumberToResults(data, startIndex) {
   var _tmpdata = [];
   $(data).each(function(cnt, item){
-    item.unshift(cnt + startIndex);
+    item.unshift(cnt + startIndex + 1);
     _tmpdata.push(item);
   });
   return _tmpdata;

+ 2 - 2
apps/rdbms/src/rdbms/templates/execute.mako

@@ -139,7 +139,7 @@ ${ commonheader(_('Query'), app_name, user) | n,unicode }
             <table id="resultTable" class="table table-striped table-condensed resultTable" cellpadding="0" cellspacing="0" data-tablescroller-min-height-disable="true" data-tablescroller-enforce-height="true">
               <thead>
                 <tr data-bind="foreach: columns">
-                  <th data-bind="text: $data"></th>
+                  <th data-bind="text: $data, css:{'datatables-counter-col': $index() == 0}"></th>
                 </tr>
               </thead>
             </table>
@@ -862,7 +862,7 @@ ${ commonshare() | n,unicode }
       var ordered_row = [];
       $.each(viewModel.columns(), function (col_index, col) {
         if (col_index == 0) {
-          ordered_row.push(index + row_index);
+          ordered_row.push(index + row_index + 1);
         }
         else {
           ordered_row.push(row[col]);

+ 4 - 0
desktop/core/src/desktop/static/desktop/css/hue3.css

@@ -2079,3 +2079,7 @@ pre {
   overflow: hidden;
   text-overflow: ellipsis;
 }
+
+.datatables-counter-col {
+  width: 10px;
+}