我们正在使用Ag-grid Enterprise显示数据。最近,我在为每一行分配不同的编辑器时遇到问题。
这是我向Long询问的查询。但是我没有得到任何帮助。 1.数据来自后台后,我将转置表格并返回到Grid。 2.在前端,我将动态设置列定义并创建Grid。 3.但是我面临的问题是我可以将编辑器设置为通用,但是我需要为日期值设置日期选择器,为数值设置数字编辑器。 4.我尝试了很多选择,但没有任何效果。
[转置网格] [1]
.map(propertyName => {
const columnDefinition: ColDef = {
headerName: propertyName,
field: propertyName,
sortable: true,
suppressMovable: true,
width: 120,
}
if (propertyName.toLowerCase() === 'parameters') {
columnDefinition.width = 230;
columnDefinition.pinned = 'left';
columnDefinition.filter = 'agTextColumnFilter';
columnDefinition.filterParams = {
clearButton: true,
};
} else {
columnDefinition.editable = this.isEdit || this.isNew;
columnDefinition.cellEditorFramework = AgGridNumericCellEditorComponent;
columnDefinition.cellEditorParams = {
decimalPlaces:4,
};
}
return columnDefinition;
});
this.defaultColDef = {
filter: false,
};
this.columnDefs = colDefs;
}```
I'm using the above code to assign the column definition dynamically.
[1]: https://i.stack.imgur.com/fhNFx.png