[英]How to filter the row data in ag-grid
我想在角度项目中过滤 ag-grid 的整个行数据。 有什么办法吗?
<ag-grid-angular
[gridOptions]="iterationGridOptions"
columnDefs]="iterationGridDef"
[rowData]="gridincidentData"
rowHeight="36"
[editType]="'fullRow'"
[components]="components"
singleClickEdit="true"
(rowClicked)="onSprintRowClicked($event)"
(rowValueChanged)="onSprintRowValueChanged($event)">
</ag-grid-angular>
我想为gridincidentData
编写一个过滤器。 我只想要isEnabled: true
值
这是我的网格事件数据看起来像
{
"_id": ObjectId("5ba8b60a7eae422533eb7e6b"),
"_class": "com.agile.historicaldata.dao.ASM",
"id": 65,
"projectId": 1,
"incidentData": [{
"_id": "1",
"openedBy": "DELA CRUZ, ANNABELLE",
"isEnabled": false
},
{
"_id": "1",
"openedBy": "APACIBLE, LORELIE T",
"isEnabled": true
},
{
"_id": "4",
"openedBy": "MASACLAO, JOMER R",
"isEnabled": false
},
{
"_id": "3",
"openedBy": "MASACLAO, JOMER R",
"isEnabled": true
},
let data = { "_id": "5ba8b60a7eae422533eb7e6b", "_class": "com.agile.historicaldata.dao.ASM", "id": 65, "projectId": 1, "incidentData": [{ "_id": "1", "openedBy": "DELA CRUZ, ANNABELLE", "isEnabled": false }, { "_id": "1", "openedBy": "APACIBLE, LORELIE T", "isEnabled": true }, { "_id": "4", "openedBy": "MASACLAO, JOMER R", "isEnabled": false }, { "_id": "3", "openedBy": "MASACLAO, JOMER R", "isEnabled": true }] } let clonedData = JSON.parse(JSON.stringify(data)); clonedData.incidentData = clonedData.incidentData.filter(({isEnabled})=> isEnabled) console.log("After Filtering Data is Same",data); console.log("After Filtering cloned Data changed",clonedData);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.