1
votes

I don't want to use the built-in Filter on ag-grid, so I tried using External Filtering in ag-grid, without success. Can someone steer me in the right direction?

HTML:

<input class="ag-filter-filter" id="filterText" type="text" ng-   change="filterOwnerField()" ng-model="Owner" placeholder="Filter Owner" />

AngularJS:

function isExternalFilterPresent()
{
    return $scope.Owner != '';
}

function doesExternalFilterPass()
{
    return $scope.Owner != '';
}

$scope.filterOwnerField = function ()
{
    $scope.gridOptions.api.onFilterChanged();
};
1

1 Answers

0
votes

Looks like the code inside isExternalFilterPresent() function does not make sense. Grid calls this method to know if external filter is present. Change your function as below -

function isExternalFilterPresent()
{
    return true;
}

Also, doesExternalFilterPass() is not used correctly. It should be like -

doesExternalFilterPass(node){
    if(node.data.filedToBeFiltered.matches(// Filter string)){
       return true;
    }
}

Refer ag-grid documentation for list of filter callbacks and their uses.