cancel
Showing results for 
Search instead for 
Did you mean: 

SAP MDK OData binding navigation pages

vhsbc92
Explorer
0 Kudos
335

Hello everyone,

I've done this tutorial Create Your First MDK Application and there we have a main page, with a customer list.

After that, we have to create a customer details page. This is a very simples step, just create an action on OnPress event to navigate to another page with the customer details content. All we have to do is create an interface to show the data and set up the target.

I'm curious about the binding navigation, I've done the same target configuration to see the list and see the details. So I'm asking myself, how the navigation between the main page and details page know exactly which record details I want to see? The only possibility is the metadata from odata sample service provided by the SAP Mobile Services cockpit. Am I right?

I've replaced the sample odata service to my custom odata service. But when I navigate from the main page to the details page, the data is not the same, is always the first record from the details table.

For example. In my main page, if I click in the first record (ID 1), I can see the details from ID 1. But if click in the record ID 5, I'm still seeing the details from ID 1. It's not binding the navigation, but in the tutorial we didn't do binding or something related. We just created a main page with odata service target and a details page with the same configuration.

I've been checking odata binding navigation properties to understand if there is something missing in my odata service. But I'm not sure if this is the way I've to follow.

Do I have to set up binding property navigation in my odata service or there is something inside the SAP MDK that needs to be done?

 

I appreciate any comments.

View Entire Topic
bill_froelich
Product and Topic Expert
Product and Topic Expert

Thanks for sharing.  Looking at your detail page, the reason you are always seeing the first record is because you defined a target for your Object Header.  When using the default binding you don't typically need to set the target but instead just bind the properties directly.  If you need to access navigation properties or other entities based on the default binding then you would define a target and potentially use the default binding property as part of the query options for the new target.

Try removing the target from your object header (leaving the field binding as is) and deploy/test again.

vhsbc92
Explorer
0 Kudos
It's different from the tutorial, but it worked. Now I'm thinking how it would be with different entity? But... I'll review the tutorial before make questions 🙂 . Thank you so much!
bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

In the tutorial you set the Page level Design Time Target. This is to let the editor know what the expected default binding will be for the Object Browser to help filter down the choices.  Unless I missed it, I don't believe the tutorial has you specify a target for the Object Header or the Key Value Section on the Detail page.  For both of those you are just using the default binding object passed into the page.