[英]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.