I've got a api endpoint that spits out the following JSON:
[{"Start": "2015-03-08T21:43:31Z", "Attendee": ["andrew", "bobo"], "End": "2015-03-08T22:43:33Z", "Description": "", "TaskID": 1, "Title": "Test Event", "OwnerID": 2, "IsAllDay": false}]
schema: {
model: {
id: "taskId",
fields: {
taskId: { from: "TaskID", type: "number" },
title: { from: "Title", defaultValue: "No title", validation: { required: true } },
start: { type: "date", from: "Start" },
end: { type: "date", from: "End" },
ownerId: { from: "OwnerID", defaultValue: 1 },
attendee: { from: "Attendee"},
isAllDay: { type: "boolean", from: "IsAllDay" }
}
}
},
resources: [
{
field: "attendee",
title: "Attendee",
dataSource: [
{ text: "Alex", value: 1, color: "#f8a398" },
{ text: "Bob", value: 2, color: "#51a0ed" },
{ text: "Charlie", value: 3, color: "#56ca85" }
]
}
]
},
All the examples I've seen for custom resources are not derived but are hard coded. How do I get the values JSON into the dataSource resource for attendee?
[{"Start": "2015-03-08T21:43:31Z", "Attendee": ["andrew", "bobo"], "End": "2015-03-08T22:43:33Z", "Description": "", "TaskID": 1, "Title": "Test Event", "OwnerID": 2, "IsAllDay": false}]
schema: {
model: {
id: "taskId",
fields: {
taskId: { from: "TaskID", type: "number" },
title: { from: "Title", defaultValue: "No title", validation: { required: true } },
start: { type: "date", from: "Start" },
end: { type: "date", from: "End" },
ownerId: { from: "OwnerID", defaultValue: 1 },
attendee: { from: "Attendee"},
isAllDay: { type: "boolean", from: "IsAllDay" }
}
}
},
resources: [
{
field: "attendee",
title: "Attendee",
dataSource: [
{ text: "Alex", value: 1, color: "#f8a398" },
{ text: "Bob", value: 2, color: "#51a0ed" },
{ text: "Charlie", value: 3, color: "#56ca85" }
]
}
]
},
All the examples I've seen for custom resources are not derived but are hard coded. How do I get the values JSON into the dataSource resource for attendee?