Answer the question
In order to leave comments, you need to log in
backbone. How to change nested property?
The Apps collection has App models.
Models have an array property offers with a status property.
How to change the value of the status property of the offers array property with a specific id?
[
{
"id": "11",
"offers": [
{
"id": "118",
"app_id": "11",
"offer": {
"wells": {
"artesian": [],
"sand": [
{
"app_id": 11,
"well_type": "sand",
"tube": "1",
"price": "1",
"warranty": "1",
"cid": "c14"
}
]
},
"comment": "",
"id": 11
},
"time": "2015-06-22 15:46:25",
"comment": "",
"status": "0",
"refuse_reason": ""
},
{
"id": "119",
"app_id": "11",
"offer": {
"wells": {
"artesian": [],
"sand": [
{
"app_id": 11,
"well_type": "sand",
"tube": "1",
"price": "1",
"warranty": "1",
"cid": "c12"
}
]
},
"comment": "",
"id": 11
},
"time": "2015-06-22 15:54:10",
"comment": "",
"status": "0",
"refuse_reason": ""
}
]
},
{
"id": "10"
},
{
"id": "4"
}
]
things.get(thing_id).get('offers').get(offer_id)
things.get(thing_id).get('offers').where({id: offer_id})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question