【发布时间】:2020-01-30 03:10:43
【问题描述】:
我正在尝试将下拉过滤器添加到 ag-grid 中的列。我已经设法使用此代码(在 Angular 8 应用程序中)显示该列:
columnDefs = [
{ headerName: 'Id' , field: 'id' , type: 'number' },
{ headerName: 'Message' , field: 'message' , type: 'text' },
{ headerName: 'Level' , field: 'level' , type: 'text' , width: 90,
filterParams: {
filterOptions: [
'empty',
{
displayKey: 'errors',
displayName: 'Errors',
test: (cellValue) => cellValue != null && cellValue === 'Error'
},
{
displayKey: 'info',
displayName: 'Information',
test: (cellValue) => cellValue != null && cellValue === 'Information'
},
{
displayKey: 'verbose',
displayName: 'Verbose',
test: (cellValue) => cellValue == null && cellValue === 'Verbose'
},
],
applyButton: true,
clearButton: true,
debounceMs: 200,
suppressAndOrCondition: true
}
},
{ headerName: 'Source' , field: 'source' , type: 'text' , width: 80 } ];
当我单击列上的汉堡菜单时,这给了我一个下拉菜单。但是,当我从上面选择一个选项时,我只会在它下面得到一个文本字段,我必须在其中输入要过滤的文本。我要做的只是选择其中一个选项,例如“错误”,它会自动按该测试功能过滤网格。那可能吗?看起来很简单,但是我花了一整天的时间阅读文档并尝试不同的东西,但似乎没有任何效果......
谢谢!
【问题讨论】:
标签: angular ag-grid ag-grid-angular