Skip to Content
0
Jun 11, 2022 at 08:15 PM

How to fetch data to GridList?

172 Views Last edit Jun 11, 2022 at 08:21 PM 3 rev

Hi Gurus,

I have two CDS Views entities on backend: C_Parent(key Parent_ID) and C_ParentChild(key Parent_UD, key Child_ID).

On the frontend side I have a <f:GridList>.

I want to get data that returns C_ParentChild and fetch them to the <f:GridList>, based on the filter C_Parent(Parent_ID = Some_ID).

I'm totally new in SAPUI5 and would be grateful for any advice and hints.

At the moment I have the next code:

XML

<f:GridList id="GridListArea" items = { path: '/C_Parent/to_C_ParentChild' }
... 
<f:GridList>

Controller
var oBinding = sap.ui.getCore().byId("GridListArea").getBinding("items");
var selectedChilds = this.getView().byId("listReport").getTable().getSelectedContexts();
var selectedParentId = selectedChilds[0].getProperty("Parent_ID");
oBinding.sPath = "/C_Parent('" + selectedParentId  + "')/to_C_ParentChild";