首页 > 解决方案 > 服务器端过滤中的 Ag-grid setFilter

问题描述

我只想检查是否可以在回调中以复杂对象而不是字符串数组的形式给出 setFilter 值。我们需要 setFilter 来拥有复杂对象的原因是因为我们正在使用服务器端过滤,并且我们希望在过滤器中显示标签,但将密钥发送回服务器以执行过滤。If we have for example objects like {name: 'some name', id: 1} we would like to show 'some name' in filter UI but when that filter is selected we need associated id (in this case 1).

通过查看 setFilter 和相应模型的源代码,似乎这是不可能的。

有没有办法可能我错过了这可以工作?

ag-Grid 版本 23.2.0

标签: filteringag-gridserver-side

解决方案


我有完全相同的问题,从界面看来确实是不可能的,因为string[]期望值

interface SetFilterValuesFuncParams {
    // The function to call with the values to load into the filter once they are ready
    success: (values: string[]) => void;

    // The column definition object from which the set filter is invoked
    colDef: ColDef;
}

推荐阅读