javascript - agGrid 汇总示例显示缺少 ClientSideRowModelModule
问题描述
我尝试执行 ag-grid 在其页面上显示的最小汇总示例。但无论如何,我不会让它工作。我得到的错误是:
ag-Grid: could not find matching row model for rowModelType clientSide
Row Model "Client Side" not found. Please ensure the ClientSideRowModelModule is loaded using: import '@ag-grid-community/client-side-row-model';
我尝试导入ClientSideRowModelModule
and ClientSideRowModel
,如错误中所述,但这没有任何改变。
我尝试并逐步浏览了捆绑的代码,似乎 agggrid 无法访问他们自己的模块,尽管它们存在。
我把例子上传到了github,直接clone,npm i && npm run rullup
然后打开index.html文件。
https://github.com/dennis-f/ag-grid-clientsiderowmodel-bug
git clone git@github.com:dennis-f/ag-grid-clientsiderowmodel-bug.git
npm i && npm run rollup
解决方案
好的,我设法让它工作。
老的:
import {Grid} from '@ag-grid-community/all-modules';
新的:
import {AllCommunityModules, Grid, ModuleRegistry} from '@ag-grid-community/all-modules';
ModuleRegistry.registerModules(AllCommunityModules);
我不知道为什么在所有这些示例中都缺少此功能,但是即使您使用 ' all-modules
' 包,您也需要手动注册模块。
它不知道所有模块都应该在启动时加载。这是一个很好的解决方案,但不幸的是它只在这里解释。
而不是AllCommunityModules
你显然可以只加载你真正需要的那些。
推荐阅读
- javascript - 无法测试外部 javascript 文件中数字的值
- python-3.x - 导入错误:没有名为“mstamp_stomp”的模块
- asp.net - 错误:无法使用本地 iis 反映 System.web.configuration.machinekeySection
- html - href 到变量 url 部分 - Angular + Bootstrap
- mysql - MYSQL UPDATE incorrect syntax?
- php - Twig - 从导入的模板中解析变量
- codeigniter - 从 POST 保存空字符串的 Doctrine 默认行为是什么?我想保存 NULL 值
- c# - 如何使用 LINQ lambda 组合多个列表
- html - 使两个相邻的 div 等高
- asp.net-mvc - 如何一次使用多个全局 ISiteMapNodeVisibilityProvider 实现?