0
votes

I'm using an external filter in ag-grid which is supposed to filter the records based on a select value dropdown which has values corresponding to a specific field in the grid.

And I'm unable to access the value of the field using node.data.fieldName as mentioned in the documentation here.

Below is what I'm doing:

function isExternalFilterPresent() {

                    return $scope.filterval.ReleaseType!='All' && $scope.filterval.ReleaseType!='';
                }
                function doesExternalFilterPass(){
                    console.log('$scope.filterval.ReleaseType : ' ,$scope.filterval.ReleaseType);
                    if($scope.filterval.ReleaseType == 'A'){return node.data.ReleaseType = 'A';}
                    if($scope.filterval.ReleaseType == 'B'){}
                    if($scope.filterval.ReleaseType == 'C'){}
                    if($scope.filterval.ReleaseType == 'D'){}
                    if($scope.filterval.ReleaseType == 'D'){}
                }

It throws an error : node is not defined When I try using just data.fieldName it says 'data is not defined'

Can someone please help me understand how I can access the value of the specific field here.

1
reproduce your issue on plunk or stackblitz. By just looking at two functions I can obviously say that node further node.data is not defined anywhere - hence, you are getting the error. - Paritosh

1 Answers

0
votes

You need to provide node as an argument to the function. calls this function with appropriate argument node.

Link: Example External filter

     function doesExternalFilterPass(node) {   // <- node as argument
       console.log('$scope.filterval.ReleaseType : ' ,$scope.filterval.ReleaseType);
       if($scope.filterval.ReleaseType == 'A'){return node.data.ReleaseType = 'A';}
           if($scope.filterval.ReleaseType == 'B'){}
             if($scope.filterval.ReleaseType == 'C'){}
             if($scope.filterval.ReleaseType == 'D'){}
             if($scope.filterval.ReleaseType == 'D'){}
       }