【发布时间】:2019-09-04 02:19:33
【问题描述】:
在我的 Jquery&JavaScript、Angular 和所有单独的应用程序中,我都将 Ag-Grid 和 columnDefs 包括在下面:-
this.columnDefs = [
{
headerName: "Age",
field: "age",
cellRenderer: "agGroupCellRenderer"
},
{
headerName: "Name",
field: "name"
},
{
headerName: "Year",
field: "year"
},
{
headerName: "Country",
field: "country"
}
];
我的行数据如下所示
this.rowData = [
{
age: "Group A",
participants: [
{
age: 1,
name: "Michael Phelps",
year: "2008",
country: "United States"
},
{
name: "A.2",
age: 2,
year: "2008",
country: "United States"
},
{
name: "A.3",
age: 50,
year: "2008",
country: "United States"
}
]}];
this.getNodeChildDetails = function getNodeChildDetails(rowItem) {
if (rowItem.participants) {
return {
group: true,
children: rowItem.participants,
};
} else {
return null;
}
现在我想根据验证将 cellClass 附加到子网格值,例如:-
if(age< 23 || ''){
return['classNameThatiWantToAttach'];
}
如何做到这一点??
您也可以为此在下面的 plunker 中进行更改:-
【问题讨论】:
-
只是为了在我的应用程序中通知rowData,我将从角度http服务获取,不会像这样使用JSON
标签: javascript jquery angular ag-grid