I am trying to do the validation for the data properties present in complex type array. Below shown is the sample breeze schema and the complex type used.
Breeze schema:
{
"name": "mailingAddress",
"complexTypeName": "Address:#test",
"isScalar":false
}
Complex type: (Address.json)
{
"name": "address",
"dataType": "String",
"validators": [
{
//some custom validator
}
]
}
In this case ,the sample data object will be like as shown below
{
mailingAddress:[
{
address:"123 street"
},
{
address:"Main Street"
}
]
}
If I change the address, the validator associated to the address data property will trigger.
My question is: I am changing the address of the first object (mailingAddress[0]
), how does breeze knows that I have changed the first address object? Is there any way to take the changed array index?
I had checked the propertyName
present in context, but it does not have the exact path.
- Expectation :
mailingAddress[0].address
- Actual :
mailingAddress.address
I am not able to do the custom validation properly because of the above problem. Kindly provide a solution for this issue.
Thanks, Dinesh