LP#1794176 Avoid capturing grid cell tooltip/display values
authorBill Erickson <berickxx@gmail.com>
Mon, 24 Sep 2018 20:19:33 +0000 (16:19 -0400)
committerDan Wells <dbw2@calvin.edu>
Mon, 24 Sep 2018 20:59:45 +0000 (16:59 -0400)
Remove the grid-tooltip logic that captured the cell content into a
template-level variable so the content only needed to be generated once
for both the tooltip and cell display.  This logic fails to handle cases
where the cell content is dynamic, typically the result of row
attributes being modified via external process.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Conflicts:
Open-ILS/src/templates/staff/share/t_autogrid.tt2

Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/templates/staff/share/t_autogrid.tt2
Open-ILS/web/js/ui/default/staff/services/grid.js

index 80c5430..d5f7f18 100644 (file)
 
           <!-- if the cell comes with its own template,
                translate that content into HTML and insert it here -->
-          <span ng-if="col.template" style="padding-left:5px; padding-right:10px;"
+          <span ng-if="col.template"
             id="{{cellId(col, item)}}"
-            ng-init="html_value=translateCellTemplate(col, item)">
+            style="padding-left:5px; padding-right:10px;">
             <span tooltip-class="eg-grid-tooltip"
               tooltip-class="eg-grid-tooltip"
               tooltip-placement="top-left"
-              uib-tooltip-html="cellOverflowed(cellId(col, item), 1) ? html_value : ''">
-              <span ng-bind-html="html_value"></span>
+              uib-tooltip-html="getHtmlTooltip(col, item)">
+              <span ng-bind-html="translateCellTemplate(col, item)"></span>
             </span>
           </span>
 
                pass through datatype-specific filtering. -->
           <span ng-if="!col.template" 
             id="{{cellId(col, item)}}"
-            ng-init="text_value = (itemFieldValue(item, col) | egGridValueFilter:col:item)"
-            uib-tooltip="{{cellOverflowed(cellId(col, item), 1) ? text_value : ''}}"
+            uib-tooltip="{{cellOverflowed(cellId(col, item), 1) ? (itemFieldValue(item, col) | egGridValueFilter:col:item) : ''}}"
             tooltip-class="eg-grid-tooltip"
             tooltip-placement="top-left"
             tooltip-class="eg-grid-tooltip"
             style="padding-left:5px; padding-right:10px;">
-            {{text_value}}
+            {{itemFieldValue(item, col) | egGridValueFilter:col:item}}
           </span>
       </div>
     </div>
index ce494da..6df298c 100644 (file)
@@ -1094,6 +1094,13 @@ angular.module('egGridMod',
                 return val;
             }
 
+            $scope.getHtmlTooltip = function(col, item) {
+                if ($scope.cellOverflowed($scope.cellId(col, item), 1)) {
+                    return grid.getItemTextContent(item, col);
+                }
+                return "";
+            }
+
             /**
              * Fetches all grid data and transates each item into a simple
              * key-value pair of column name => text-value.