【问题标题】:External Filter on ag-grid not workingag-grid 上的外部过滤器不起作用
【发布时间】:2017-06-03 07:44:42
【问题描述】:

我不想在 ag-grid 上使用内置过滤器,所以我尝试在 ag-grid 中使用外部过滤,但没有成功。有人可以引导我朝着正确的方向前进吗?

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();
};

【问题讨论】:

    标签: angularjs ag-grid


    【解决方案1】:

    看起来isExternalFilterPresent() 函数内的代码没有意义。 Grid 调用此方法来了解是否存在外部过滤器。如下更改您的功能 -

    function isExternalFilterPresent()
    {
        return true;
    }
    

    另外,doesExternalFilterPass() 使用不正确。应该是-

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

    请参阅ag-grid 文档以获取过滤器回调列表及其用途。

    【讨论】:

      猜你喜欢
      • 2020-06-12
      • 2017-01-28
      • 2020-11-19
      • 2018-06-01
      • 2020-06-08
      • 2017-01-30
      • 2019-03-06
      • 2019-10-19
      • 2018-10-04
      相关资源
      最近更新 更多