简体   繁体   English

当主/详细信息处于活动状态并且至少一行扩展到其详细信息时,Ag-grid 更新数据失败

[英]Ag-grid update data fails when master/detail is active and at least one row expanded to it's details

I'm using Ag-grid angular enterprise edition in my project.我在我的项目中使用 Ag-grid angular 企业版。 I set the grid data by clicking on a submit form button using grid's API as follow:我通过使用网格的 API 单击提交表单按钮来设置网格数据,如下所示:

api.setRowData(newData);

the update data will be done without any problem if masterDetail is inactive.如果 masterDetail 处于非活动状态,更新数据将毫无问题地完成。 in gridOption在网格选项中

masterDetail: false,主详细信息:假,

If i try to use masterDetail option, update form works until one row expanded to it's details.如果我尝试使用 masterDetail 选项,则更新表单会一直工作,直到将一行扩展为详细信息。 after that submit button won't change the grid data rows in the screen anymore.之后提交按钮将不再更改屏幕中的网格数据行。 however when i get the grid data by grid's API like this:但是,当我通过网格的 API 获取网格数据时:

let rowData = [];
api.forEachNode(node => rowData.push(node.data));
console.log(rowData)

the rowData is the correct data in the console, but in action I can't see the correct data in the grid. rowData 是控制台中的正确数据,但实际上我看不到网格中的正确数据。

I hopefully found the problem.我希望找到了问题。 my mistake was that the Id I set for rowNode wasn't unique.我的错误是我为 rowNode 设置的 Id 不是唯一的。 after fixing that the problem solved.修复后问题解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM