在Ag-Grid中更新行数据时,列过滤器丢失 [英] Column filter lost when updating row data in ag-grid

查看:519
本文介绍了在Ag-Grid中更新行数据时,列过滤器丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在ag-grid中预先配置一个列过滤器,这是一个简单的文本等于过滤器,以仅显示与某些指定文本匹配的行,我已经做到了。

I am trying to pre-configure a column filter in ag-grid, a simple text "equals" filter to show only rows matching some specified text, I have got this working.

但是,一旦我用一组新的行替换了模型数据,过滤器就会消失。

However as soon as I replace the model data with a fresh set of rows, my filter disappears.

我尝试用两种方法更新模型数据:

I have tried updating my model data in 2 ways:


  • 通过替换绑定的rowData属性的值(我正在使用Vue.js)

  • 调用api.setRowData(newRows)

这两者都会导致列过滤器丢失。

Both of these cause the column filter to be lost.

有没有一种方法可以更新模型数据而不丢失列过滤器?

Is there a way to update the model data without losing column filters?

推荐答案

它说a href = https://www.ag-grid.com/javascript-grid-data-update/#delta-row-data&gsc.tab=0 rel = noreferrer>文档您可以设置 gridOptions 属性 deltaRowDataMode = true ,然后使用 api.setRowData( newRows)。这会将当前行数据与新数据进行比较,以查看已更改的内容并进行相应的更新。如果没有设置此属性,则网格会剔除所有设置以确保重新开始。

In their documentation it says that you can set the gridOptions property deltaRowDataMode=true, then use the api.setRowData(newRows). This will compare the current row data to the new data to see what has changed and update accordingly. Without this property set, the grid rips out all settings to ensure a fresh start.

这篇关于在Ag-Grid中更新行数据时,列过滤器丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆