I have an employee training database, and I need a master detail grid that allows you to select an employee and see the trainings they have taken.
There is a many-to-many relationship between employees and trainings. The join table has attributes that must be displayed in the detail grid also:
This odata query to the API provides the information:
http://localhost:25584/odata/Training(a6fe3f50-be18-4132-7037-08d931b6a033)?$expand=EmployeeTrainings($expand=Employee)
Result:
{
"@odata.context": "http://localhost:25584/odata/$metadata#Employee(EmployeeTrainings(Training()))/$entity",
"Id": "8b77e372-d038-456d-f61e-08d931b637dd",
"OrgDefinedId": 111111111,
"Designation": "",
"EmployeeTrainings": [
{
"EmployeeId": "8b77e372-d038-456d-f61e-08d931b637dd",
"TrainingId": "a6fe3f50-be18-4132-7037-08d931b6a033",
"Attended": "No",
"Cohort": "N/A",
"CompletionStatus": "InProgress",
"Deliverables": "None",
"PeerCheck": "No",
"StipendOneRequested": "No",
"StipendTwoRequested": "No",
"StipendThreeRequested": "No",
"StipendOneStatus": "NotStarted",
"StipendTwoStatus": "NotStarted",
"StipendThreeStatus": "NotStarted",
"Notes": "",
"Training": {
"Id": "a6fe3f50-be18-4132-7037-08d931b6a033",
"Host": "FC",
"Name": "Using the Death Star2",
"StartDate": "2021-08-28T09:10:00-07:00",
"EndDate": "2021-08-26T00:00:00-07:00",
"Facillitator": "Darth Vader",
"StipendAmountOne": 100,
"StipendAmountTwo": 150,
"StipendAmountThree": 200,
"ProgramType": "LiveSession"
}
}
]
}
Problem:
I cant figure out how to correctly populate the detail grid when an employee is selected. Ideally, the detail grid would contain information from the EmployeeTraining table and the Training table like so:
See attached files
Attachment:
Employee_4158518e.zip