【发布时间】:2020-09-13 10:19:06
【问题描述】:
我正在使用 Vue.js 使用 ag 网格来显示表格。我有一个这样的列定义:
{
headerName: "Status",
field: "featureStatus",
width: 110,
editable: true,
cellEditor: "agSelectCellEditor ",
cellEditorParams: {
values: []
}
},
this.allFeatureStatusNames 是一个返回字符串数组的计算变量:
allFeatureStatusNames: function() {
return this.allFeatureStatuses.map(status => status.name)
}
我有一个关于 allFeatureStatuses 的观察者,我想在创建表后更新 cellEditorParams:
allFeatureStatuses: function() {
let colDef = this.columnDefs.find(col => col.headerName == "Status")
if (colDef) {
colDef.cellEditorParams = {
values: this.allFeatureStatusNames
}
}
this.gridColumnApi.refreshCells()
},
我遇到的问题是单元格编辑器永远不会更新。它总是空的。表格创建后如何刷新或更新 cellEditorParams?
【问题讨论】:
标签: ag-grid ag-grid-vue