使用"controller as"语法的ag-grid rowData,你可以按照以下步骤进行操作:
app.controller("MainController", function() {
this.rowData = [
{ name: "John", age: 25 },
{ name: "Jane", age: 30 },
// more data...
];
});
app.controller("MainController", function() {
this.rowData = [
{ name: "John", age: 25 },
{ name: "Jane", age: 30 },
// more data...
];
this.gridOptions = {
columnDefs: [
{ headerName: "Name", field: "name" },
{ headerName: "Age", field: "age" },
],
rowData: this.rowData
};
});
通过这种方式,你可以使用"controller as"语法在ag-grid中的rowData属性中引用controller中的变量。确保在HTML文件中正确引用controller,并在controller中定义正确的rowData变量和ag-grid配置对象。