Skip to content

Commit 4898084

Browse files
committed
- enableSorting grid default option will be overridable by column def, so enableSort could be set to specific column.
1 parent becebb5 commit 4898084

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/js/core/directives/ui-grid-header-cell.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
});
230230

231231
// Figure out whether this column is sortable or not
232-
if (uiGridCtrl.grid.options.enableSorting && $scope.col.enableSorting) {
232+
if ($scope.col.enableSorting) {
233233
$scope.sortable = true;
234234
}
235235
else {

src/js/core/factories/GridColumn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ angular.module('ui.grid')
640640
//self.cursor = self.sortable ? 'pointer' : 'default';
641641

642642
// Turn on sorting by default
643-
self.enableSorting = typeof(colDef.enableSorting) !== 'undefined' ? colDef.enableSorting : true;
643+
self.enableSorting = typeof(colDef.enableSorting) !== 'undefined' ? colDef.enableSorting : self.grid.options.enableSorting;
644644
self.sortingAlgorithm = colDef.sortingAlgorithm;
645645

646646
/**

src/js/core/factories/GridOptions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ angular.module('ui.grid')
356356
* @propertyOf ui.grid.class:GridOptions
357357
* @description True by default. When enabled, this setting adds sort
358358
* widgets to the column headers, allowing sorting of the data for the entire grid.
359-
* Sorting can then be disabled on individual columns using the columnDefs.
359+
* Sorting can then be disabled / enabled on individual columns using the columnDefs,
360+
* if it set, it will override GridOptions enableSorting setting.
360361
*/
361362
baseOptions.enableSorting = baseOptions.enableSorting !== false;
362363

0 commit comments

Comments
 (0)