on 08-21-2023 4:04 PM
Hi Experts,
I have a scenario where i have just one GET call.
It has other child entities with association to parent entity.
When I am trying to bind, I am getting the data from parent entity,but not able to read child entity as they are under deferred tag in odata response.
How can i read the
child related data?
Hi Aditya,
You can add the expand command to your binding like below;
i.e. For a Table binding, simply add it to the items aggregation in your XML view.
<Table
items="{
path: '/yourEntity',
parameters : {
expand : 'Process'
}
}" >
If you are bindign the view in your controller, you can try adding the parameter like this.
this.getView().bindElement({
path: "/yourEntity"
parameters: {
expand: "Process"
}
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you show how your binding or code looks like?
You can use it in the XML View
<Table id="trackTable" items="{ path: '/Track', parameters: { expand: 'Process' } }">
<!-- Sample columns for main entity -->
<columns>
<Column><Text text="Process ID" /></Column>
<Column><Text text="Object ID" /></Column>
<Column><Text text="Changed On" /></Column>
<Column><Text text="Description from Process" /></Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text text="{ProcessId}" />
<Text text="{Objectid}" />
<Text text="{Datetimelin}" />
<Text text="{Process/Description}" /> <!-- Assuming 'Description' exists in 'Process' entity -->
</cells>
</ColumnListItem>
</items>
</Table>
or in the Controller
oModel.read("/Track", {
urlParameters: {
"$expand": "Process"
},
success: function(oData, oResponse) {
// Data successfully fetched
console.log(oData);
// oData.results will have the fetched data
},
error: function(oError) {
// Error handling
console.error("Data fetch failed:", oError);
}
});
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.