From 7fc55b5d255b5940139717e35e891a7b3a5bee3a Mon Sep 17 00:00:00 2001 From: Brian Hann Date: Wed, 15 Jan 2014 15:08:50 -0600 Subject: [PATCH] fix(uiGrid): introduced a bug that added columns over and over when data was swapped --- src/js/core/directives/ui-grid.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/js/core/directives/ui-grid.js b/src/js/core/directives/ui-grid.js index 40a5bb9885..b87aeb2bf4 100644 --- a/src/js/core/directives/ui-grid.js +++ b/src/js/core/directives/ui-grid.js @@ -56,8 +56,8 @@ * @description factory to return dom specific instances of a grid * */ - module.service('gridClassFactory', ['gridUtil','$q','$templateCache','uiGridConstants','$log', - function (gridUtil,$q,$templateCache,uiGridConstants,$log) { + module.service('gridClassFactory', ['gridUtil', '$q', '$templateCache', 'uiGridConstants', '$log', + function (gridUtil, $q, $templateCache, uiGridConstants, $log) { var service = { /** @@ -193,10 +193,10 @@ } var col = self.getColumn(colDef.field); - //if (!col) { + if (!col) { col = new GridColumn(colDef, index); self.columns.push(col); - //} + } self.columnBuilders.forEach(function (builder) { builderPromises.push(builder.call(self, colDef, col, self.options)); @@ -412,7 +412,7 @@ * @param {ColDef} colDef column definition * @returns {string} resulting name that can be evaluated on scope */ - GridRow.prototype.getQualifiedColField = function(colDef){ + GridRow.prototype.getQualifiedColField = function(colDef) { return 'row.entity.' + colDef.field; }; @@ -452,8 +452,7 @@ return service; }]); - module.controller('uiGridController',['$scope', '$element', '$attrs','$log','gridUtil','$q','uiGridConstants', - '$templateCache','gridClassFactory', + module.controller('uiGridController', ['$scope', '$element', '$attrs', '$log', 'gridUtil', '$q', 'uiGridConstants', '$templateCache', 'gridClassFactory', function ($scope, $elm, $attrs, $log, gridUtil, $q, uiGridConstants, $templateCache, gridClassFactory) { $log.debug('ui-grid controller'); @@ -538,8 +537,8 @@ }; //todo: throttle this event? - self.fireScrollEvent = function(){ - $scope.$broadcast(uiGridConstants.events.GRID_SCROLL,'vertical'); + self.fireScrollEvent = function() { + $scope.$broadcast(uiGridConstants.events.GRID_SCROLL, 'vertical'); }; }]); @@ -610,12 +609,11 @@ module.directive('uiGrid', ]); - module.directive('uiGridCell', ['$compile','uiGridConstants','$log', function ($compile,uiGridConstants,$log) { + module.directive('uiGridCell', ['$compile', 'uiGridConstants', '$log', function ($compile, uiGridConstants, $log) { var ngCell = { priority: 0, scope: false, compile: function() { - return { pre: function($scope, $elm) { // $log.debug('uiGridCell pre-link');