英文:
AG Grid open in large text from context menu
问题
没有找到一种方法可以在使用默认的agTextCellEditor
编辑器的情况下,通过上下文菜单来使用agLargeTextCellEditor
编辑单元格。我尝试过使用startEditingCell
函数,但没有成功。
英文:
Using AG Grid is there a way to have a cell use the default agTextCellEditor
editor but from the context menu be able to edit the cell with a agLargeTextCellEditor
?
I haven't been able to figure out a way to set the columnDefs on the fly to accomplish this.
Trying to use the startEditingCell
function with no luck.
答案1
得分: 1
我猜你想在它们之间切换。
基本上,你需要更新列定义。例如:
action: () => {
var columnDefs = gridOptions.api.getColumnDefs()
columnDefs.forEach(function (colDef, index) {
if (colDef.colId === 'athlete') {
colDef.cellEditor = colDef.cellEditor == 'agTextCellEditor' ? 'agLargeTextCellEditor' : 'agTextCellEditor'
}
})
gridOptions.api.setColumnDefs(columnDefs)
}
你可以在上下文菜单中添加一个项目来执行此操作,并使用上面的方法。
在这里。我已经为你准备好了一个 plunker。单击切换以在 agTextCellEditor 和 agLargeTextCellEditor 之间切换。
https://plnkr.co/edit/xz9WwmS9laL7saO5?preview
英文:
I guess you wanna toggle between them.
Basically, you need to update column definitions. E.x.
action: () => {
var columnDefs = gridOptions.api.getColumnDefs()
columnDefs.forEach(function (colDef, index) {
if (colDef.colId === 'athlete') {
colDef.cellEditor = colDef.cellEditor == 'agTextCellEditor' ? 'agLargeTextCellEditor' : 'agTextCellEditor'
}
})
gridOptions.api.setColumnDefs(columnDefs)
}
You may put an item in your context menu for this purpose and use the method above.
Here you are. I've got a plunker ready for you. Click on toggle to toggle between agTextCellEditor and agLargeTextCellEditor.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论