ODATA v4 Master Detail Data Grid: Populating the Detail Grid

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:

2021-08-27_14-32-42.jpg

See attached files


Attachment: Employee_4158518e.zip

4 Replies

JP Jeevakanth Palaniappan Syncfusion Team August 30, 2021 12:24 PM UTC

Hi Scot, 

Greetings from Syncfusion support. 

We have validated your query and you can refer the below online demo link to use master detail sample. 

GitHub sample for the sample shown in the demo  - https://github.com/syncfusion/blazor-samples 

Get back to us if you need any further assistance. 

Regards, 
Jeevakanth SP. 



SW Scot Woodyard August 30, 2021 06:04 PM UTC

I've reviewed that example, but it is not helpful.  I need an ODATA example.



JP Jeevakanth Palaniappan Syncfusion Team August 31, 2021 04:50 PM UTC

Hi Scot, 

Currently we are validating your query from our end and so we will update the further details in two business days(on or before Sep 2). Until then we appreciate your patience. 

Regards, 
Jeevakanth SP. 



JP Jeevakanth Palaniappan Syncfusion Team September 2, 2021 02:58 PM UTC

Hi Scot, 

Thanks for your patience. 

We have analyzed your code’s and found that you have not bounded the data for the detail grid. It is necessary for the grid to bind the data either by using the DataSource property or by using the SfDataManager. The query will be applied to the grid only based on the data bounded to the grid. Since you have not bounded data to the grid, it will not populate any data. SO we suggest you to set data either by using the DataSource property or by using the SfDataManager. 

Please refer the below documentation for your reference, 

Incase if you still face any issues then kindly share us the below details, 

  1. Share us the complete controller codes.
  2. Kindly share us the runnable issue reproducing sample.

The above requested details will be helpful for us to validate your problem and to provide you with a better solution as early as possible. 

Regards, 
Jeevakanth SP. 


Loader.
Up arrow icon