我正在从数据库中获取数据并通过将手动操作按钮列添加到 Ag-Grid 来填充它。现在,第一列由那些操作按钮组成,第二列包含 _id 我想隐藏第二列,但在 ag-grid 文档中,他们只提供了关于隐藏静态数据列的信息。这是我的包含 def 列的代码。
setMasterData (state, payload) {
if (!payload) {
state.tableData.rows = [];
} else {
// First column holds the buttons to delete the row item
let cols = [{
field: '',
headerName: 'Actions',
width: 200,
colId: 'params',
cellRendererFramework: 'gridEditButtons'
}];
cols = cols.concat(Object.keys(payload[0]).map(x => {
return {
field: x,
headerName: x.replace(/([A-Z])/g, ' $1').replace(/^./, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); })
};
}));
state.tableData.cols = cols;
state.tableData.rows = payload;
}
}
如何隐藏操作列之后的下一列?