cancel
Showing results for 
Search instead for 
Did you mean: 

How to fetch data to GridList?

former_member611643
Participant
0 Kudos

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";

Accepted Solutions (1)

Accepted Solutions (1)

ThorstenHoefer
Active Contributor
0 Kudos

Hi, in the grid list., you need a relative path, like

<f:GridList id="GridListArea" items="{to_C_ParentChild}">
... 
<f:GridList>

The view must be bound to the parent. For example, this can be done in onRouteMatch

this.getView().bindElement("/C_Parent(parent_id='ABC')")
former_member611643
Participant
0 Kudos

Thanks a lot, Throsten.

That was a good hint.

Answers (0)