小编Tim*_*Tim的帖子

AgGrid/Angular 2:无法访问 setRowData()。网格渲染,不显示 rowData

解决了(有点)我相信我的解决方案是杰瑞操纵的,并表明我不正确地设置了我的猫鼬模型。

下面的答案确实帮助我解决了我的问题,所以我检查了它,但最终空白数据行的原因是属性中的标识符不正确

IE。在 my-gridcomponent-name.component.ts 中

gridOptions.columnDef.field 
Run Code Online (Sandbox Code Playgroud)

我需要使用实际的数据库字段名称/标识符设置字段属性。

我使用的是我在 mongoose Schema 中分配的名称/标识符,而不是数据库的实际字段名称/标识符。例如,模式标识符,其中所有一个单词都是小写,而数据库标识符以大写开头,并且单词之间可能有一个 _。



问题从这里开始......


我正在从 MongoDB 获取一组 JSON 对象,并希望在 agGrid 中显示它们。

$ng version angular-cli: 1.0.0-beta.28.3 node: 6.9.2 os: win32 x64 
@angular/common: 2.4.10 
@angular/compiler: 2.4.10 
@angular/core: 2.4.10 
@angular/forms: 2.4.10 
@angular/http: 2.4.10 
@angular/platform-browser: 2.4.10 
@angular/platform-browser-dynamic: 2.4.10 
@angular/router: 3.4.10 
@angular/compiler-cli: 2.4.10
Run Code Online (Sandbox Code Playgroud)

我 99% 确定我有数组中的数据并且它可用于我的 html 页面。

1) console.log(Array.isArray(self.catalogue)) //true

2)我*ngFor<ag-grid-angular>标签下方进行了测试。有效。

<div *ngFor='let note of catalogue'> 
    <li>{{note.Country}}</li> 
    <li>{{note.Authority}}</li> ......etc 
</div>
Run Code Online (Sandbox Code Playgroud)

这篇文章有一个我的 agGrid 的截图——它有标题和滚动条,就好像数据是用隐形墨水打印的。 UI Grid Angular,网格呈现但不显示数据

如果我只是在构造函数中硬编码一些对象,则 rowData 将显示。

constructor(private …
Run Code Online (Sandbox Code Playgroud)

javascript ag-grid angular

6
推荐指数
1
解决办法
2065
查看次数

标签 统计

ag-grid ×1

angular ×1

javascript ×1