gpt4 book ai didi

updates - ag-grid cell使用 deltaRowDataMode 进行渲染

转载 作者:行者123 更新时间:2023-12-02 16:36:07 25 4
gpt4 key购买 nike

嗨,我有一些带有自定义渲染的单元格当我更新所有数据时,deltaRowDataMode不支持我的剪切单元渲染的变化。已更新行的其他单元格已正确更新。

如何为农业网格提供线索以正确比较此自定义单元格

最佳答案

我刚刚遇到了同样的问题,并从 ag-grid 文档中找到了线索。在 Cell Renderer帮助文档讨论了 ICellRendererComp.refresh 方法:

// Mandatory - Get the cell to refresh. Return true if the refresh succeeded, otherwise return false.
// If you return false, the grid will remove the component from the DOM and create
// a new component in it's place with the new values.
refresh(params: ICellRendererParams): boolean;

在下面的示例中:

// gets called whenever the user gets the cell to refresh
MyCellRenderer.prototype.refresh = function(params) {
// set value into cell again
this.eValue.innerHTML = params.valueFormatted ? params.valueFormatted : params.value;
// return true to tell the grid we refreshed successfully
return true;
};

然后,我在 CellRenderer 上实现了刷新功能,如下所示,无需更改任何单元格内容:

statusCellRenderer.prototype.refresh = function (params) {
//ensure the status cell\directive refreshes when the grid data is refreshed using deltaRowDataMode
this.params = params;
return true;
};

因此,就我而言,我在轮询循环中刷新网格的 rowData,并且我不希望网格继续丢失所选行。我在 gridOptions 上设置了 deltaRowDataModegetRowNodeId 属性,然后实现刷新函数以使单元格在刷新时重新渲染。刷新还会在我的单元格中重新呈现指令。

关于updates - ag-grid cell使用 deltaRowDataMode 进行渲染,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49774251/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com