2
我正在使用defiantjs來選擇對象中的元素。這是我的對象:如何用xPath選擇多個元素?
{
"name": "Retail Sales",
"weight": 10,
"length": 6,
"type": "retailSales",
"rows": [
{
"dealerEvaluationHistoryID": 0,
"performanceDealerMappingDetailID": 14,
"month": 1,
"plan": 0,
"actual": 0,
"weight": 0,
"pelanggaranWilayah": 0
},
{
"dealerEvaluationHistoryID": 0,
"performanceDealerMappingDetailID": 14,
"month": 2,
"plan": 0,
"actual": 0,
"weight": 0,
"pelanggaranWilayah": 0
},
{
"dealerEvaluationHistoryID": 0,
"performanceDealerMappingDetailID": 14,
"month": 3,
"plan": 0,
"actual": 0,
"weight": 0,
"pelanggaranWilayah": 0
}
]
}
如何在行[]中的每個對象中選擇所有月份,計劃,實際和重量? 想我喜歡這樣的輸出:
[[1,0,0,0],[2,0,0,0],[3,0,0,0]]
我可以做//rows/month
和//rows/plan
但不知道如何執行這兩種。
正是我一直在尋找!將接受這個作爲定時器的時候的答案:) –