Skip to content

Commit

Permalink
Fixed resizing columns issue.
Browse files Browse the repository at this point in the history
Fixed initial grouping issue when using
domUtilityService.RebuildGrid($scope, grid).
  • Loading branch information
jonricaurte committed Jun 28, 2013
1 parent b496c87 commit 7f63979
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 21 deletions.
10 changes: 6 additions & 4 deletions build/ng-grid.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ng-grid JavaScript Library
* Authors: https://github.com/angular-ui/ng-grid/blob/master/README.md
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
* Compiled At: 06/27/2013 06:27
* Compiled At: 06/27/2013 22:03
***********************************************/
(function(window, $) {
'use strict';
Expand Down Expand Up @@ -1593,6 +1593,9 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,
cols.push(column);
});
$scope.columns = cols;
if ($scope.configGroups.length > 0) {
self.rowFactory.getGrouping($scope.configGroups);
}
}
};
self.configureColumnWidths = function() {
Expand Down Expand Up @@ -1663,7 +1666,7 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,
throw "unable to parse column width, use percentage (\"10%\",\"20%\", etc...) or \"*\" to use remaining width of grid";
}
} else if (ngColumn.visible !== false) {
totalWidth += ngColumn.width = parseInt(colDef.width, 10);
totalWidth += ngColumn.width = parseInt(ngColumn.width, 10);
}
});

Expand Down Expand Up @@ -2430,8 +2433,6 @@ var ngRowFactory = function (grid, $scope, domUtilityService, $templateCache, $u
}, $scope, grid, domUtilityService, $templateCache, $utils));
}
}

domUtilityService.BuildStyles($scope, grid, true);
grid.fixColumnIndexes();
$scope.adjustScrollLeft(0);
self.parsedData.length = 0;
Expand Down Expand Up @@ -3009,6 +3010,7 @@ ngGridDirectives.directive('ngGrid', ['$compile', '$filter', '$templateCache', '
grid.config.columnDefs = a;
grid.buildColumns();
grid.eventProvider.assignEvents();
domUtilityService.RebuildGrid($scope, grid);
}, true);
}
else {
Expand Down
10 changes: 6 additions & 4 deletions build/ng-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ng-grid JavaScript Library
* Authors: https://github.com/angular-ui/ng-grid/blob/master/README.md
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
* Compiled At: 06/27/2013 06:27
* Compiled At: 06/27/2013 22:03
***********************************************/
(function(window, $) {
'use strict';
Expand Down Expand Up @@ -1372,6 +1372,9 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,
cols.push(column);
});
$scope.columns = cols;
if ($scope.configGroups.length > 0) {
self.rowFactory.getGrouping($scope.configGroups);
}
}
};
self.configureColumnWidths = function() {
Expand Down Expand Up @@ -1429,7 +1432,7 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,
throw "unable to parse column width, use percentage (\"10%\",\"20%\", etc...) or \"*\" to use remaining width of grid";
}
} else if (ngColumn.visible !== false) {
totalWidth += ngColumn.width = parseInt(colDef.width, 10);
totalWidth += ngColumn.width = parseInt(ngColumn.width, 10);
}
});
if (percentArray.length > 0) {
Expand Down Expand Up @@ -2130,8 +2133,6 @@ var ngRowFactory = function (grid, $scope, domUtilityService, $templateCache, $u
}, $scope, grid, domUtilityService, $templateCache, $utils));
}
}

domUtilityService.BuildStyles($scope, grid, true);
grid.fixColumnIndexes();
$scope.adjustScrollLeft(0);
self.parsedData.length = 0;
Expand Down Expand Up @@ -2682,6 +2683,7 @@ ngGridDirectives.directive('ngGrid', ['$compile', '$filter', '$templateCache', '
grid.config.columnDefs = a;
grid.buildColumns();
grid.eventProvider.assignEvents();
domUtilityService.RebuildGrid($scope, grid);
}, true);
}
else {
Expand Down
4 changes: 2 additions & 2 deletions build/ng-grid.min.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions ng-grid-2.0.7.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ng-grid JavaScript Library
* Authors: https://github.com/angular-ui/ng-grid/blob/master/README.md
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
* Compiled At: 06/27/2013 06:27
* Compiled At: 06/27/2013 22:03
***********************************************/
(function(window, $) {
'use strict';
Expand Down Expand Up @@ -1593,6 +1593,9 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,
cols.push(column);
});
$scope.columns = cols;
if ($scope.configGroups.length > 0) {
self.rowFactory.getGrouping($scope.configGroups);
}
}
};
self.configureColumnWidths = function() {
Expand Down Expand Up @@ -1663,7 +1666,7 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,
throw "unable to parse column width, use percentage (\"10%\",\"20%\", etc...) or \"*\" to use remaining width of grid";
}
} else if (ngColumn.visible !== false) {
totalWidth += ngColumn.width = parseInt(colDef.width, 10);
totalWidth += ngColumn.width = parseInt(ngColumn.width, 10);
}
});

Expand Down Expand Up @@ -2430,8 +2433,6 @@ var ngRowFactory = function (grid, $scope, domUtilityService, $templateCache, $u
}, $scope, grid, domUtilityService, $templateCache, $utils));
}
}

domUtilityService.BuildStyles($scope, grid, true);
grid.fixColumnIndexes();
$scope.adjustScrollLeft(0);
self.parsedData.length = 0;
Expand Down Expand Up @@ -3009,6 +3010,7 @@ ngGridDirectives.directive('ngGrid', ['$compile', '$filter', '$templateCache', '
grid.config.columnDefs = a;
grid.buildColumns();
grid.eventProvider.assignEvents();
domUtilityService.RebuildGrid($scope, grid);
}, true);
}
else {
Expand Down
4 changes: 2 additions & 2 deletions ng-grid-2.0.7.min.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/classes/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,
cols.push(column);
});
$scope.columns = cols;
if ($scope.configGroups.length > 0) {
self.rowFactory.getGrouping($scope.configGroups);
}
}
};
self.configureColumnWidths = function() {
Expand Down Expand Up @@ -447,7 +450,7 @@ var ngGrid = function ($scope, options, sortService, domUtilityService, $filter,
throw "unable to parse column width, use percentage (\"10%\",\"20%\", etc...) or \"*\" to use remaining width of grid";
}
} else if (ngColumn.visible !== false) {
totalWidth += ngColumn.width = parseInt(colDef.width, 10);
totalWidth += ngColumn.width = parseInt(ngColumn.width, 10);
}
});

Expand Down
1 change: 1 addition & 0 deletions src/directives/ng-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
grid.config.columnDefs = a;
grid.buildColumns();
grid.eventProvider.assignEvents();
domUtilityService.RebuildGrid($scope, grid);
}, true);
}
else {
Expand Down
6 changes: 3 additions & 3 deletions workbench/main2.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ function userController($scope, $timeout) {
};

$scope.changeDefs = function(){
$scope.myDefs = [{ field: 'Sku', displayName: 'My Sku' },
$scope.myDefs = [{ field: 'Sku', displayName: 'My Sku', width: '40%' },
{ field: 'Vendor', displayName: 'Supplier', editableCellTemplate: '<input type="number" style="width:100px; height:30px;" ng-model="COL_FIELD" ng-input="COL_FIELD" />' },
{ field: 'SeasonCode.test', displayName: 'My SeasonCode', cellTemplate: '<input style="width:100%;height:100%;" class="ui-widget input" type="text" ng-readonly="!row.selected" ng-model="COL_FIELD"/>' },
{ field: 'Mfg_Id', displayName: 'Manufacturer ID' },
{ field: 'UPC', displayName: 'Bar Code' }];
{ field: 'Mfg_Id', displayName: 'Manufacturer ID', width:'100px' },
{ field: 'UPC', displayName: 'Bar Code', width:200 }];
};

$scope.callMethod();
Expand Down
3 changes: 2 additions & 1 deletion workbench/main4.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ function userController($scope) {
showGroupPanel: true,
columnDefs: 'myDefs',
showColumnMenu: true,
enableColumnReordering: true
enableColumnReordering: true,
enableColumnResize:true
};

$scope.myData = [{ 'Sku': 'C-2820164', 'Vendor': 'NEWB', 'SeasonCode': 0, 'Mfg_Id': '573-9880954', 'UPC': '822860449228' },
Expand Down

0 comments on commit 7f63979

Please sign in to comment.