Hi Experts,
I just started learning UI5. I started an application to implement complete navigation of OData Service from
http://services.odata.org/V3/OData/OData.svc/
The Goal of the application is
First I need to show Categories split app ( Master Page)
If I select any Category application should show only Products related that category.
By Googling I was able to move half way but second of I am unable to move forward
Current application status is like this
I am using Component.js to navigate from one view to other
When I execute application I am getting results as below
When I click on any Category it should show the products on details page
just like using this Service
http://services.odata.org/V3/OData/OData.svc/Categories(0)/Products
if you execute above link in IE you will get Products only related to Categories(0)
So based on this concept
in ProductsList Page I was able to get the context for above in the following way
this.catIndex = evt.getParameter('arguments').catIndex;
var context = sap.ui.getCore().byId("app").getModel('products').getContext('/Categories(' + this.catIndex + ')/Products');
this.getView().setBindingContext(context,'products');
Once the binding was done in controller if I use the following binding for list
oList.bindItems({
path : "products>/Categories/Products",
template : new sap.m.StandardListItem({
title: "{products>Name}",
type: sap.m.ListType.Navigation,
press:function(evt){
oController.categoryListItemPress(evt);
}
})
});
I am getting list of all the products irrespective of Categories
But if I hard bind like this
oList.bindItems({
path : "products>/Categories(1)/Products",
template : new sap.m.StandardListItem({
title: "{products>Name}",
type: sap.m.ListType.Navigation,
press:function(evt){
oController.categoryListItemPress(evt);
}
})
});
I am getting correct products related to Category(1)
Now my question is how can I dynamically set the context for model
If that is not possible how can I pass dynamic path to the view base on the selection
Thanks
Uma