ag-grid-ng2 - 在刷新视图/刷新单元格后设置焦点在 ag 网格角度 2 中不起作用
问题描述
我有一个单元格渲染器,它是一个文本框。
<input type="text"[(ngModel)]="textVal" class="form-control mb-2 mr-sm-2 mb-sm-0"
id="measurename" (input)="onValChange()">
每当我在文本框中写东西时,我都会根据一些逻辑更新其他行中的数据
for (const node of this.selectedRowNodes) {
if (this.parameterDefMap[this.parameterDefName]) {
node.data.parameters[this.gridParams.colDef.field] = this.textVal;
}
}
之后我尝试刷新单元格/视图以更新网格中的数据
const cell: GridCell = this.gridParams.api.getFocusedCell();
this.gridParams.api.refreshCells(params);
if (cell) {
this.gridParams.api.setFocusedCell(cell.rowIndex, cell.column);
const col = cell.column.getColDef().field;
}
网格已成功刷新,但我的问题是刷新焦点丢失后,当我尝试将焦点设置到具有文本字段的单元格时,焦点未设置。
解决方案
推荐阅读
- android - Glide Picasso 不会加载本地存储视频的缩略图路径
- c++ - 用 cython 包装的 C++ 函数的时序
- java - 在 Android Studio 中查找准确的日期时间
- python - 如何使用诱变剂打印 ID3 标签
- go - path.Join 的可移植性用于 URL 路径
- android - AccountsManager.get(this).getAccounts 始终为 0
- android - 如何使用 RestTemplate 在响应正文(身份验证 Web 服务)中返回令牌?
- c# - 将 byte[] 转换为显式结构的最简单方法
- mysql - MySQL 到 H2 DDL 的问题
- .net - 无法解析 ASP.NET Core DI 类型的服务