Issue
I have an ag-grid and I am dynamically loading data into it. I have enabled column sorting, however it does not work. Nothing happens when I click on the column header. I'm not sure what the issue is. Below is my code:
var colobj = {};
for(i = 0; i< file.fieldMetadata.length; i++){
var len = file.fieldMetadata[i].name.length;
colobj = {'headerName' : file.fieldMetadata[i].name, 'field' : file.fieldMetadata[i].name, sortingOrder: ['asc','desc', 'null']};
vm.columnDefs.push(colobj);
vm.gridOptions.api.setColumnDefs(vm.columnDefs);
vm.gridOptions.api.setRowData(vm.fileContentsCols);
vm.gridOptions.enableSorting = true;
Solution
The enableSorting won't work here. Only call to api function will work.
You have to set gridOptions.enableSorting = true from the beginning (not after receive the data).
The gridOptions is merely a holder for initialisation. Once the grid is initialise, the api field is available to interact with the grid, all change to parameters won't work.
Answered By - Walfrat
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.