0

I have problem to enable disabled sorting in ui-grid in Angular 1. I try this in grid columnsDefs:

{
  ...
  enableSorting: false
}, 

And I try to overwrite it when something is happening in my controller:

$scope.$watch("vm.verifiedCreatedRecords", function(newVal, oldVal){
  if(newVal.length > 0){ 

    vm.UpdateCreationGridOptions.columnDefs[4].enableSorting = true;
  } 
  else {
        vm.sortingCreate = false;
  }

}, true);

vm.UpdateCreationGridOptions.columnDefs[4].enableSorting become true, but the grid is not enable sorting. It remains with default status for sorting.

Also I have set for general option: "useExternalSorting: true"

Any ideas regarding how can I refresh the ui-grid? Thanks!

1 Answer 1

1

Try below refresh approaches

$scope.UpdateCreationGridOptions.core.queueGridRefresh();
$scope.UpdateCreationGridOptions.core.refresh();
$scope.UpdateCreationGridOptions.grid.refreshCanvas();
$scope.UpdateCreationGridOptions.grid.refreshRows();
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for this info. I solve it with an return false in the custom sorting function.
Also I read some options are dynamic, some not. I don't find anyway in the documentation how to handle options which are set when the controller is initialized.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.