如何在不触发刷新的情况下更新AG网格的行?
我的目标是添加一个自定义的广播按钮,以允许用户选择一行。目前,我有
const Cell = (cellProps) => {
const { data, node, api } = cellProps
const selectedRow = () => {
let { isChecked } = data
let radioButtonLabel = ''
const newRowData =[]
api.forEachNode((currNode) => {
const currRowData = currNode.data
if (id === currNode.data.id) {
currRowData.isChecked = true
radioButtonLabel = currNode.data.name
}
newRowData.push(currRowData)
})
api.setRowData(newRowData)
}}
问题的问题是,当用户选择表底部的一行的单元按钮时,它会刷新网格(我相信setrowdata触发了一个刷新),并且用户必须滚动到底部桌子看他们的选择。我希望能够在用户选择“广播”按钮时停止刷新,但不确定如何使用AG-Grid实现。
My goal is to add a custom radio button to allow the user to select a row. At the moment I have
const Cell = (cellProps) => {
const { data, node, api } = cellProps
const selectedRow = () => {
let { isChecked } = data
let radioButtonLabel = ''
const newRowData =[]
api.forEachNode((currNode) => {
const currRowData = currNode.data
if (id === currNode.data.id) {
currRowData.isChecked = true
radioButtonLabel = currNode.data.name
}
newRowData.push(currRowData)
})
api.setRowData(newRowData)
}}
So the problem is that when the user selects a radio button of a row on the bottom of my table, it refreshes the grid (I believe setRowData triggers a refresh) and the user has to scroll to the bottom of the table to see their selection. I want to be able to stop the refresh when the user selects the radio button but not sure how that can be implemented with AG-Grid.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过 this 文档。具体来说,关于
getRowid
(或getRownodeId
)提供行ID的零件,取决于您的版本),这将使交易效率更高,而无需刷新。
示例
如果您只想添加一个复选框以进行选择在这里是文档,但您似乎需要广播电台按钮。
Read through this documentation. Specifically the part about providing the row id with
getRowId
(orgetRowNodeId
depending on your version)It will make the transaction much more efficient without refreshing.
example
If you just want to add a checkbox for selection here is the documentation but you seem to need a radio button.