$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content
0

How to get the Expand parameters from Master to Detail page?

Nov 15, 2016 at 02:49 PM

55

avatar image

Hello All,

I face an issue with one of the Master-Detail app developed using the oData services.

Master view list items are binded with "/Products" with Expand to navigation properties "toSupplier,toContent".

Now, using the router mechanism I have passed the path of the selected product via Parameter to detail view. Read the path in the detail view controller and bound the Object Header with this path to display the same details. I have few tabs under the Object header displaying Supplier and Content Details. Under these tabs while I refer to the relevant fields as "{toSupplier/SupplierID}" or "{toConent/ContentID}" is not displaying any data.

As per my understanding, I noticed the oData available in the Master View, but the same is not available in Detail view.

Can you please suggest on how to get the data binding with expand parameters available to detial view?

Cheers

Sunil

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Jun Wu Nov 15, 2016 at 03:55 PM
0

code please

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hello Jun Wu,

Here is the code snippet

Master View :-

<List id="slist" items="{ path: '/shopping_cartSet', parameters: { expand: 'ToVendor,sc_to_tech_specs,sc_to_contents' } }" >

<StandardListItem title="{Zpname}" description="{Zcategory}" type="Active" press="onPress"></StandardListItem>

</List>

Master Controller:-

onPress: function (oEvent){

var oSource = oEvent.getSource(); var oContext = oSource.getBindingContext().getPath();

var oRouter = sap.ui.core.UIComponent.getRouterFor(this); var oModel = this.getView().getModel();

oRouter.navTo( "object", {Path : oContext.substring(1)}); }

Detail View:-

<IconTabBar id="TabBar">

<items>

<IconTabFilter text="Tech.Specs" id="Tech">

<l:VerticalLayout> <Label text="Model"/> <Text text="{sc_to_tech_specs/Zmodel}"/> <Label text="Make"/> <Text text="{sc_to_tech_specs/Zmake}"/> </l:VerticalLayout>

</IconTabFilter>

<IconTabFilter text="Contents"> <l:VerticalLayout> <Label text="Model"/> <Text text="{sc_to_contents/Zmodel}"/> <Label text="Make"/> <Text text="{sc_to_contents/Zmake}"/> </l:VerticalLayout>

</IconTabFilter>/

<IconTabBar>

Detail Controller:-

_onObjectMatched: function(oEvent){

var oPath = oEvent.getParameters().arguments.Path; var oContext = oEvent.getSource().oBindingContexts; var oBject = this.getView().byId("OBH"); var oTab = this.getView().byId("Tech"); oBject.bindContext("/" + oPath); oTab.bindContext("/" + oPath); }

Routes:-

{ "pattern": "Objects/{Path}", "name": "object", "target": ["master", "object"] }

Target:-

"object": { "viewName": "Detail", "viewId": "detail", "viewLevel": 2 },

Hope these snippets provide you a good information.

Cheers,

Sunil

0

Closing this question as the issue is with the oData service and not the UI5 controls.

Appreciate your help :)

0
sunil varma chintalapati Nov 15, 2016 at 10:59 PM
0

Hello Jun Wu,

Here is the code snippet

Master View :-

<List id="slist" items="{ path: '/shopping_cartSet', parameters: { expand: 'ToVendor,sc_to_tech_specs,sc_to_contents' } }" >

<StandardListItem title="{Zpname}" description="{Zcategory}" type="Active" press="onPress"></StandardListItem>

</List>

Master Controller:-

onPress: function (oEvent){

var oSource = oEvent.getSource(); var oContext = oSource.getBindingContext().getPath();

var oRouter = sap.ui.core.UIComponent.getRouterFor(this); var oModel = this.getView().getModel();

oRouter.navTo( "object", {Path : oContext.substring(1)}); }

Detail View:-

<IconTabBar id="TabBar">

<items>

<IconTabFilter text="Tech.Specs" id="Tech">

<l:VerticalLayout> <Label text="Model"/> <Text text="{sc_to_tech_specs/Zmodel}"/> <Label text="Make"/> <Text text="{sc_to_tech_specs/Zmake}"/> </l:VerticalLayout>

</IconTabFilter>

<IconTabFilter text="Contents"> <l:VerticalLayout> <Label text="Model"/> <Text text="{sc_to_contents/Zmodel}"/> <Label text="Make"/> <Text text="{sc_to_contents/Zmake}"/> </l:VerticalLayout>

</IconTabFilter>/

<IconTabBar>

Detail Controller:-

_onObjectMatched: function(oEvent){

var oPath = oEvent.getParameters().arguments.Path; var oContext = oEvent.getSource().oBindingContexts; var oBject = this.getView().byId("OBH"); var oTab = this.getView().byId("Tech"); oBject.bindContext("/" + oPath); oTab.bindContext("/" + oPath); }

Routes:-

{ "pattern": "Objects/{Path}", "name": "object", "target": ["master", "object"] }

Target:-

"object": { "viewName": "Detail", "viewId": "detail", "viewLevel": 2 },

Hope these snippets provide you a good information.

Cheers,

Sunil

Share
10 |10000 characters needed characters left characters exceeded