My API is returning the following JSON:
{
"data": [
{
"BookingID": 1,
"Driver": "John Doe",
"VehicleID": 1,
"Registration": "CHH708",
"Fleet": "DN30",
"Destination": "Akaroa",
"Notes": "Going to ...",
"StartTimezone": null,
"Start": "2014/11/20 08:00",
"End": "2014/11/20 11:00",
"EndTimezone": null,
"RecurrenceRule": null,
"RecurrenceID": null,
"RecurrenceException": null,
"Pickup": false
},
{
"BookingID": 2,
"Driver": "Paul McCartney",
"VehicleID": 2,
"Registration": "DRF457",
"Fleet": "DN30",
"Destination": "Whangarei",
"Notes": "Going to ...",
"StartTimezone": null,
"Start": "2014/11/19 14:00",
"End": "2014/11/19 19:00",
"EndTimezone": null,
"RecurrenceRule": null,
"RecurrenceID": null,
"RecurrenceException": null,
"Pickup": true
}
],
"success": true,
"status": 200
}
how do I specidy in my model that what I'm after is inside "data" ?
I have the following:
dataSource: {
transport: {
read: {
url: "http://mocksvc.mulesoft.com/mocks/9c484836-5464-4c75-b8e5-1f433e861bd1/bookings",
dataType: "jsonp"
}
},
schema: {
model: {
fields: {
bookingId: { from: "BookingID", type: "number" },
destination: { from: "Destination", type: "string" },
registration: { from: "Registration", type: "string" },
fleet: { from: "Fleet", type: "string" },
driver: { from: "Driver", type: "string" },
start: { type: "date", from: "Start" },
end: { type: "date", from: "End" },
bookedDateTime: { type: "date", from: "BookedDateTime" },
pickupDateTime: { type: "date", from: "PickUpTime" },
dropoffDateTime: { type: "date", from: "DropOffTime" },
notes: { from: "Notes" },
vehicleId: { from: "VehicleID"},
pickup: { type: "boolean", from: "Pickup" },
dropoff: { type: "boolean", from: "DropOff" },
actions: { from: "BookingID", type: "number" }
}
}
},
but it's not reading it...
{
"data": [
{
"BookingID": 1,
"Driver": "John Doe",
"VehicleID": 1,
"Registration": "CHH708",
"Fleet": "DN30",
"Destination": "Akaroa",
"Notes": "Going to ...",
"StartTimezone": null,
"Start": "2014/11/20 08:00",
"End": "2014/11/20 11:00",
"EndTimezone": null,
"RecurrenceRule": null,
"RecurrenceID": null,
"RecurrenceException": null,
"Pickup": false
},
{
"BookingID": 2,
"Driver": "Paul McCartney",
"VehicleID": 2,
"Registration": "DRF457",
"Fleet": "DN30",
"Destination": "Whangarei",
"Notes": "Going to ...",
"StartTimezone": null,
"Start": "2014/11/19 14:00",
"End": "2014/11/19 19:00",
"EndTimezone": null,
"RecurrenceRule": null,
"RecurrenceID": null,
"RecurrenceException": null,
"Pickup": true
}
],
"success": true,
"status": 200
}
how do I specidy in my model that what I'm after is inside "data" ?
I have the following:
dataSource: {
transport: {
read: {
url: "http://mocksvc.mulesoft.com/mocks/9c484836-5464-4c75-b8e5-1f433e861bd1/bookings",
dataType: "jsonp"
}
},
schema: {
model: {
fields: {
bookingId: { from: "BookingID", type: "number" },
destination: { from: "Destination", type: "string" },
registration: { from: "Registration", type: "string" },
fleet: { from: "Fleet", type: "string" },
driver: { from: "Driver", type: "string" },
start: { type: "date", from: "Start" },
end: { type: "date", from: "End" },
bookedDateTime: { type: "date", from: "BookedDateTime" },
pickupDateTime: { type: "date", from: "PickUpTime" },
dropoffDateTime: { type: "date", from: "DropOffTime" },
notes: { from: "Notes" },
vehicleId: { from: "VehicleID"},
pickup: { type: "boolean", from: "Pickup" },
dropoff: { type: "boolean", from: "DropOff" },
actions: { from: "BookingID", type: "number" }
}
}
},
but it's not reading it...