You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AG-Grid首次打开筛选器时出现‘Virtual list has not been created’错误求助

AG-Grid 筛选器首次打开报“Virtual list has not been created”错误(关联keyCreator)

问题现象

  • 网格渲染完成后,首次打开目标列的筛选器时,控制台抛出Virtual list has not been created错误,筛选器无法正常加载
  • 先打开其他任意列的筛选器,再返回打开目标列的筛选器,此时筛选器能正常显示所有可选值

问题定位

该错误明确与列定义中filterParams的keyCreator函数相关:移除该函数后错误完全消失,但由于我的筛选值是对象类型,必须通过keyCreator提取对象中的label字段作为筛选选项的标识,因此不能直接移除。

相关列定义代码

filterParams: {
  keyCreator: (params: KeyCreatorParams) => params.value?.label,
  valueFormatter: (params: ValueFormatterParams) => params.value?.label,
  buttons: ['clear'],
} as ISetFilterParams,

环境信息

  • React 18.2.0
  • AG-Grid 31.0.0
  • 测试环境:最新版Chrome、Edge浏览器

已尝试的解决方案

  • 调整keyCreator的写法(比如添加空值兜底、修改返回值类型等),错误依旧
  • 排查AG-Grid其他配置代码,确认只有移除keyCreator才能解决问题,但这不符合业务需求

求助需求

希望了解该错误的触发原因,以及在保留keyCreator的前提下,如何让筛选器首次打开就能正常工作。

内容的提问来源于stack exchange,提问作者cejlonski

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.01 08:31:14