简体   繁体   English

每当行更新时,React ag-grid 分组就会崩溃

[英]React ag-grid grouping collapses whenever row gets updated

I am feeding data to ag-grid via redux state.我通过 redux 状态向 ag-grid 提供数据。 I have a button in each row using which I can update the specific row data.我在每一行都有一个按钮,我可以使用它来更新特定的行数据。 When I update, API is called and newly updated data will come from API and it is updated in redux state which in turn gets updated in Grid.当我更新时,API 被调用,新更新的数据将来自 API,并在 redux 状态下更新,进而在 Grid 中更新。

I am achieving this using the deltaRowDataMode .我正在使用deltaRowDataMode实现这一点。 This deltaRowDataMode will only update specific row data.这个deltaRowDataMode只会更新特定的行数据。 Data update is working fine.数据更新工作正常。 But when I group a column, expand the rows and then update a row data, ag-grid collapsing the grouping, though update is happening fine.但是,当我对列进行分组,展开行然后更新行数据时,ag-grid 会折叠分组,尽管更新进行得很好。 For sorting, filtering it is working beautifully.对于排序,过滤它工作得很好。

I tried rememberGroupStateWhenNewData , it is not working.我试过rememberGroupStateWhenNewData ,它不工作。 I check many functionalities like expandAll, etc., but none of them suits my condition.我检查了许多功能,例如 expandAll 等,但没有一个适合我的情况。 Is there any build in functionality or approach which prevents AG-Grid from collapsing the grouping when update happens?是否有任何内置功能或方法可以防止 AG-Grid 在更新发生时折叠分组?

Unfortunately, I am not allowed to share any code anywhere.不幸的是,我不允许在任何地方共享任何代码。 Sorry about that.对于那个很抱歉。

Thank you谢谢

below grid options helped me fix this issue:下面的网格选项帮助我解决了这个问题:

rememberGroupStateWhenNewData: true, suppressScrollOnNewData: true,记住GroupStateWhenNewData:真,suppressScrollOnNewData:真,

您必须维护一个不可变的数据存储来跟踪行,以便打开组保持打开状态并且不会在更新数据时崩溃。

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

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