Skip to content

Commit 35e36ba

Browse files
authored
Merge pull request #4828 from idangozlan/fix-enableSorting-idangozlan
- enableSorting grid default option will be overridable by column def…
2 parents 1dda0a4 + 1866625 commit 35e36ba

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
@@ -235,7 +235,7 @@
235235
});
236236

237237
// Figure out whether this column is sortable or not
238-
if (uiGridCtrl.grid.options.enableSorting && $scope.col.enableSorting) {
238+
if ($scope.col.enableSorting) {
239239
$scope.sortable = true;
240240
}
241241
else {

src/js/core/factories/GridColumn.js

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

647647
// Turn on sorting by default
648-
self.enableSorting = typeof(colDef.enableSorting) !== 'undefined' ? colDef.enableSorting : true;
648+
self.enableSorting = typeof(colDef.enableSorting) !== 'undefined' ? colDef.enableSorting : self.grid.options.enableSorting;
649649
self.sortingAlgorithm = colDef.sortingAlgorithm;
650650

651651
/**

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)