daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest May 16th, 2018 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $scope.formatDate = function(date) {
  2.     return '42';
  3.   };
  4.  
  5.   $scope.columns = [
  6.     {field: 'date', cellTemplate: '<div class="ui-grid-cell-contents">formatDate({{row.entity.date}})</div>'},
  7.     {field: 'title'},
  8.     {field: 'quantity'},
  9.     //[...]
  10.   ];
  11.    
  12. $scope.columns = [
  13.     {field: 'getFormattedDate()'},
  14.     //[...]
  15.   ];
  16.  
  17.   $http.post('/api/data/').success(function (data) {
  18.     $scope.gridOptions.data = data.elements;
  19.  
  20.     $scope.gridOptions.data.forEach(function(row) {
  21.       row.getFormattedDate = function() {
  22.         return '42';
  23.       }
  24.     })
  25.   });
  26.    
  27. {
  28.     name: 'date',
  29.     cellTemplate: '<div class="ui-grid-cell-contents">{{grid.appScope.parseDate(row.entity.date)}}</div>'
  30. }
  31.    
  32. <div class="ui-grid-cell-contents">{{ formatDate(row.entity.date) }}</div>
  33.    
  34. columnDefs: [
  35.             {
  36.                 name: 'starRating', headerCellClass: 'blue', headerTooltip: 'Star Rating',
  37.                 cellTemplate: '{{grid.appScope.formatRating(row.entity.starRating)}}'
  38.             },
  39.    
  40. columnDefs: [
  41.             {
  42.                 name: 'starRating', headerCellClass: 'blue', headerTooltip: 'Star Rating',
  43.                 cellTemplate: '<span>{{grid.appScope.formatRating(row.entity.starRating)}}</span>'
  44.             },
  45.    
  46. $scope.formatRating = function (starRating) {
  47.         switch (starRating) {
  48.             case "ONE": return "1/5"; break;
  49.             case "TWO": return "2/5"; break;
  50.             case "THREE": return "3/5"; break;
  51.             case "FOUR": return "4/5"; break;
  52.             case "FIVE": return "5/5"; break;
  53.         }
  54.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top