通过在 ag 网格中的列中搜索找出行索引
Find out row index by searching in column in ag grid
我需要在特定列的 ag 网格中按名称找到新提交的学生记录,并在 flashCell 方法中传递行 ID 以突出显示新条目
flashNewStudentRecord(rowIndex: number) {
var rowNode1 = this.gridApi.getDisplayedRowAtIndex(rowIndex);
this.gridApi.flashCells({
rowNodes: [rowNode1],
});
}
现在我必须在 'Student Name ' 列的客户端数据中搜索学生姓名并获取行索引以在上述方法中传递它,关于如何实现的任何建议
无法在我的数据源中搜索网格,因为它是异步的,而且它的行为很奇怪
您可以通过 cellRenderFramework
中的一种方式执行此操作。在那里你可以从参数中得到 rowIndex
。
这里有一个例子:
cellRendererFramework: (params) => {
if(params.column?.columnId === "yourExactcolumnYouWantToTestOn"){
if(prams.value ==="yourValueToTestOn"){
//call your flash function, or the best would be to delay it, using setTimeOut
flashNewStudentRecord(params.rowIndex)
}
}
return <AgGridCellRenderer>
</AgGridCellRenderer>
},
我需要在特定列的 ag 网格中按名称找到新提交的学生记录,并在 flashCell 方法中传递行 ID 以突出显示新条目
flashNewStudentRecord(rowIndex: number) {
var rowNode1 = this.gridApi.getDisplayedRowAtIndex(rowIndex);
this.gridApi.flashCells({
rowNodes: [rowNode1],
});
}
现在我必须在 'Student Name ' 列的客户端数据中搜索学生姓名并获取行索引以在上述方法中传递它,关于如何实现的任何建议
无法在我的数据源中搜索网格,因为它是异步的,而且它的行为很奇怪
您可以通过 cellRenderFramework
中的一种方式执行此操作。在那里你可以从参数中得到 rowIndex
。
这里有一个例子:
cellRendererFramework: (params) => {
if(params.column?.columnId === "yourExactcolumnYouWantToTestOn"){
if(prams.value ==="yourValueToTestOn"){
//call your flash function, or the best would be to delay it, using setTimeOut
flashNewStudentRecord(params.rowIndex)
}
}
return <AgGridCellRenderer>
</AgGridCellRenderer>
},