Ag-Grid 在编辑下一个单元格时防止 API.StopEditing() 回调 (Angular)
Ag-Grid Prevent API.StopEditing() callback when editing next cell (Angular)
我目前正在为 angular 5 开发 AG Grid。我对单元格编辑功能有疑问。通过我的点击事件,我使用以下代码以编程方式启用所选行列的编辑模式
selectedNods.forEach(element => {
if (element.node.selected)
element.node.gridApi.startEditingCell({
rowIndex: element.node.rowIndex,
colKey: "account"
});
});
这很好用。但是当我为了编辑目的进入一个单元格时,
所有其他单元格从编辑模式返回正常模式。
我想保留所有选定的行,指定的单元格应该是可编辑的,即使我正在编辑单元格也是如此。
请帮助我。
整行编辑模式将帮助您而不是 cell editing
。
使用 [editType]="'fullRow'"
属性 共 ag-grid。
执行此操作后,您可以使用 cellClicked
事件使 row/cell 可编辑。
(cellClicked)="onCellClicked($event)"
在您的组件中,
onCellClicked($event){
// check whether the current row is already opened in edit or not
if(this.editingRowIndex != $event.rowIndex) {
console.log($event);
$event.api.startEditingCell({
rowIndex: $event.rowIndex,
colKey: $event.column.colId
});
this.editingRowIndex = $event.rowIndex;
}
}
中查看这个实例
我目前正在为 angular 5 开发 AG Grid。我对单元格编辑功能有疑问。通过我的点击事件,我使用以下代码以编程方式启用所选行列的编辑模式
selectedNods.forEach(element => {
if (element.node.selected)
element.node.gridApi.startEditingCell({
rowIndex: element.node.rowIndex,
colKey: "account"
});
});
这很好用。但是当我为了编辑目的进入一个单元格时,
所有其他单元格从编辑模式返回正常模式。
我想保留所有选定的行,指定的单元格应该是可编辑的,即使我正在编辑单元格也是如此。
请帮助我。
整行编辑模式将帮助您而不是 cell editing
。
使用 [editType]="'fullRow'"
属性 共 ag-grid。
执行此操作后,您可以使用 cellClicked
事件使 row/cell 可编辑。
(cellClicked)="onCellClicked($event)"
在您的组件中,
onCellClicked($event){
// check whether the current row is already opened in edit or not
if(this.editingRowIndex != $event.rowIndex) {
console.log($event);
$event.api.startEditingCell({
rowIndex: $event.rowIndex,
colKey: $event.column.colId
});
this.editingRowIndex = $event.rowIndex;
}
}
中查看这个实例