How to disable sorting for a specific columns in Ag-grid?

Neeraj Jain picture Neeraj Jain · May 25, 2017 · Viewed 7.7k times · Source

I am using https://www.ag-grid.com/ in one of my AngularJs projects.My requirement is to disable the sorting on any column while any grouping is happening.

I know we can disable sorting/filtering on single column with below configuration:

colDef.suppressMenu = true
colDef.suppressSorting = true <--- this i can set up while giving column definition

but how to do it dynamically on the specific condition, For more clarification please check the image below enter image description here

In this, I am grouping the grid by country and expanding Ireland country but now I don't to disable sorting on any parameter and enable it again when grouping attribute is removed.

Is there a way to achieve this, Please let me know and if any duplicate question already exists please add that in the comment section.

Thanks

Answer

Chawki Messaoudi picture Chawki Messaoudi · May 25, 2017
colDef.suppressMenu = true
colDef.suppressSorting = true

http://www.angulargrid.com/angular-grid-column-definitions/index.php

Exemple: http://jsfiddle.net/7ony74h5/1/