如何在过滤器为空时显示叠加文本
How to show overlay text while filter is empty
我需要在用户尝试过滤任何列时显示未找到结果消息。
有没有办法在AG-Grid中实现?
[noRowsOverlayComponent]="noRowsOverlayComponent"
在此处查找示例。尝试为任何列输入任何不正确的值。
我想你想在网格中没有记录时显示 NoRowsOverlay
。
检查我创建的这个插件:ag-grid Custom Overlay Components - when there are no rows to display.
打开这个 Plunk 并尝试用 zzz
字符串过滤第一列。当网格中没有记录时,您会看到它正在运行。
如何:
一种方法(在许多方法中 - 我假设)是在 ag-grid 的 onModelUpdated
事件中执行此操作。
触发此事件时,检查网格中是否有 rowsToDisplay
。取决于此,您可以决定是否要显示覆盖。
onModelUpdated($event){
if(this.gridApi && this.gridApi.rowModel.rowsToDisplay.length == 0) {
this.gridApi.showNoRowsOverlay();
}
if(this.gridApi && this.gridApi.rowModel.rowsToDisplay.length > 0) {
this.gridApi.hideOverlay();
}
}
我需要在用户尝试过滤任何列时显示未找到结果消息。
有没有办法在AG-Grid中实现?
[noRowsOverlayComponent]="noRowsOverlayComponent"
在此处查找示例。尝试为任何列输入任何不正确的值。
我想你想在网格中没有记录时显示 NoRowsOverlay
。
检查我创建的这个插件:ag-grid Custom Overlay Components - when there are no rows to display.
打开这个 Plunk 并尝试用 zzz
字符串过滤第一列。当网格中没有记录时,您会看到它正在运行。
如何:
一种方法(在许多方法中 - 我假设)是在 ag-grid 的 onModelUpdated
事件中执行此操作。
触发此事件时,检查网格中是否有 rowsToDisplay
。取决于此,您可以决定是否要显示覆盖。
onModelUpdated($event){
if(this.gridApi && this.gridApi.rowModel.rowsToDisplay.length == 0) {
this.gridApi.showNoRowsOverlay();
}
if(this.gridApi && this.gridApi.rowModel.rowsToDisplay.length > 0) {
this.gridApi.hideOverlay();
}
}