0
votes

I'm playing with ag-grid in Angular. I'd like to have some columns sortable and/or resizable and others not. I see in docs, that properties like sortable and resizable in columnDefs should work. But they don't. The only way I can make columns to be sortable and filterable is to add properties enableFilter and enableColResize in gridOptions like that:

gridOptions = {
    defaultColDef: {
      tooltip: (t: any) => { return t.value; }
    },
    overlayNoRowsTemplate: '<span></span>',
    overlayLoadingTemplate: '<span></span>',
    enableSorting:true,
    enableFilter: true,
    enableColResize: true,
    domLayout: 'normal'
  };

<ag-grid-angular
  #agGrid
  style="width: 100%; height: 335px;"
  class="ag-theme-balham"
  (modelUpdated)="onModelUpdated()"
  (selectionChanged)="onSelectionChanged($event)"
  [gridOptions]="gridOptions"
  [columnDefs]="columnDefs"
  [rowData]="rowData"
  animateRows
  rowSelection="single"
>

But when using that this way I'm not able to config specific columns to work the way I want it to work. Does anybody know, what's a problem here?

1

1 Answers

1
votes

This is because you are using an older version of ag-grid (19.1.4 or earlier). You can either update your version of ag-grid to 20.0.0 or newer by running the npm update command or you could use suppressSorting, suppressFilter and resizable properties in columnDefs which is the alternative for the same functionality in older versions, but you must first set enableFilter and enableSorting to true for suppress sorting and suppress filter to work.