I have a dataset loading via JSON into a Store which is represented by 3 models. The models pretty much exactly reflect the structure of the JSON as such I have the following:
JSON:
Code:
{
"Client":{
"Id":"123456",
"Title":"Mr",
"FirstName":"Joe",
"Surname":"Blogs",
"Booking":[
{
"BookingNodeId":123456,
"Origin":"London",
"Destination":"Paris"
},
{
"BookingNodeId":1234567,
"Origin":"London",
"Destination":"Dubai"
},
{
"BookingNodeId":12345678,
"Origin":"London",
"Destination":"Tokyo"
}
],
"Contact":[
{
"Name":"Steve",
"PhoneNumber":"08001231234"
}
]
}
}
Models:
Code:
Client:
Id, Title, FirstName, Surname
HasManyAssociation: Booking
HasManyAssociation: Contact
Booking:
BookingNodeId, Origin, Destination
Contact
Name, PhoneNumber
Store:
Code:
ClientStore
JSONReader loads the JSON and has implicitIncludes set meaning that the Client, Bookings and Contacts models are all loaded and setup at the same time (which is exactly what I want).
If I set the Store property of my DataView to be the ClientStore, everything works fine provided I set the properties in my DataViewTemplate to be Client.Booking.Origin for example.
What I want to know is how I can set the Store of my DataView to be a sub-model of my Client model. For example how would I set it so that the Bookings were the items that are bound to the DataView?
do I need to set up another Store or do I need to refactor in some other way?
Thanks
Chris