在ag-Grid中,如果未应用defaultColDef,则可以使用以下方法解决:
var columnDefs = [
{ headerName: "Make", field: "make", width: 100 },
{ headerName: "Model", field: "model", width: 100 },
{ headerName: "Price", field: "price", width: 100 },
];
var gridOptions = {
// ...其他gridOptions属性...
defaultColDef: {
width: 100,
},
};
var columnDefs = [
{ headerName: "Make", field: "make", type: "text" },
{ headerName: "Model", field: "model", type: "text" },
{ headerName: "Price", field: "price", type: "numeric" },
];
var columnTypes = {
text: { width: 100 },
numeric: { width: 100 },
};
var gridOptions = {
// ...其他gridOptions属性...
columnDefs: columnDefs,
columnTypes: columnTypes,
};
这些是在ag-Grid中解决未应用defaultColDef的几种常见方法,你可以根据你的需求选择其中一种。