$(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

Not able to Bind OData in VBOX in SAPUI5

Jan 27, 2017 at 11:37 AM

3.4k

avatar image

IN the Manifest.json I had created OData model

<m:Tableid="idProductsTable"items="{path : 'invoice2>/UserDetails'}"

mode="SingleSelectLeft">

<m:columns>

<m:Column>

<m:Texttext="Company"/>

</m:Column>

</m:columns>

<m:items>

<m:ColumnListItem>

<m:cells>

<m:Texttext="{invoice2>Company}"/>

</m:cells>

</m:ColumnListItem>

</m:items>

</m:Table>

By the above code I am able to bind the data and the output is coming. But the issue is

that when I use the VBOX in the GRID control and output is not coming

.

<layout:Gridbinding="{invoice2>/UserDetails}">

<layout:content>

<m:VBox>

<m:Texttext="{invoice2>Company}"/>

</m:VBox>

</layout:content>

</layout:Grid>

10 |10000 characters needed characters left characters exceeded

but if i had used below code and i am not able to display and the out put is not displaying.And i am not seeing any error but output is not displaying

<m:Page enableScrolling="true" title="{i18n>userProfileApp}" showNavButton="false" navButtonPress="navButtonPress">

<ObjectPageLayout id="ObjectPageLayout" enableLazyLoading="true" upperCaseAnchorBar="false" showHeaderContent="true" subSectionLayout="TitleOnTop">

<headerContent>

<layout:Grid defaultIndent="L0 M0 S0" defaultSpan="L6 M6 S6" position="Left" width="100%" containerQuery="false" hSpacing="0" vSpacing="0">

<layout:content>

<layout:Grid content="{invoice2>/UserDetails}" id="headerContentUserProfile" defaultIndent="L0 M0 S0" defaultSpan="L12 M12 S12" position="Left" width="100%" containerQuery="false" hSpacing="0" vSpacing="0">

<layout:content>

<m:HBox>

<m:Text text="{i18n>company}:" width="7rem" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit" />

<m:Text text="{invoice2>Company}" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit" />

</m:HBox>

</layout:content>

</layout:Grid>

</layout:content>

</layout:Grid>

</headerContent>

</ObjectPageLayout>

</m:Page>

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
VIPLOVE KHUSHALANI Jan 27, 2017 at 12:04 PM
0

Hi Durga ,

The property you are mentioning in Grid is wrong its not 'binding' its 'content' :

<layout:Grid content ="{invoice2>/UserDetails}">

<layout:content>

<m:VBox>

<m:Texttext="{invoice2>Company}"/>

</m:VBox>

</layout:content>

</layout:Grid>

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

Thanks for the Answer , but if i had used below code and i am not able to display and the out put is not displaying.And i am not seeing any error but output is not displaying

<m:Page enableScrolling="true" title="{i18n>userProfileApp}" showNavButton="false" navButtonPress="navButtonPress">

<ObjectPageLayout id="ObjectPageLayout" enableLazyLoading="true" upperCaseAnchorBar="false" showHeaderContent="true" subSectionLayout="TitleOnTop">

<headerContent>

<layout:Grid defaultIndent="L0 M0 S0" defaultSpan="L6 M6 S6" position="Left" width="100%" containerQuery="false" hSpacing="0" vSpacing="0">

<layout:content>

<layout:Grid content="{invoice2>/UserDetails}" id="headerContentUserProfile" defaultIndent="L0 M0 S0" defaultSpan="L12 M12 S12" position="Left" width="100%" containerQuery="false" hSpacing="0" vSpacing="0">

<layout:content>

<m:HBox>

<m:Text text="{i18n>company}:" width="7rem" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit" />

<m:Text text="{invoice2>Company}" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit" />

</m:HBox>

</layout:content>

</layout:Grid>

</layout:content>

</layout:Grid>

</headerContent>

</ObjectPageLayout>

</m:Page>

0

Hi,

Are you attaching the model on the global model? can you just show where are you setting the model ?

thanks

Viplove

0

i am attaching the model in manifest.json

"sap.app":

{ "_version": "1.1.0",

"id": "usrprofile.app",

"type": "application",

"dataSources" :

{ "invoicedet": {

"uri": "http://10.145.243.20:8080/sap/opu/odata/sap/ZGRC_USER_PROFILE_SRV/",

"type" : "oData" } },

"sap.ui": {

"models": {

"invoice2":

{

"type": "sap.ui.model.odata.v2.ODataModel",

"dataSource": "invoicedet" }

0

Hi Durga ,

If this service is your main service you need to provide the data sources like this (example using the northwind service) :

"dataSources":

{ "mainService":

{ "uri": "/northwind/V3/northwind/northwind.svc/",

"type": "OData",

"settings": {

"odataVersion": "2.0",

"localUri": "localService/metadata.xml"

}

}

},

And also instead of using the URL directly just create a destination on cockpit and than declare that destination in neoapp.json and than use it here in the URI of data sources.

0

But Data is coming if i use

<m:Page enableScrolling="true" title="{i18n>userProfileApp}" showNavButton="false" navButtonPress="navButtonPress" >

<layout:Grid content="{invoice2>/UserDetails}" id="headerContentUserProfile" defaultIndent="L0 M0 S0" defaultSpan="L12 M12 S12" position="Left" width="100%" containerQuery="false" hSpacing="0" vSpacing="0">

<layout:content>

<m:HBox>

<m:Text text="{i18n>company}:" width="7rem" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit" />

<m:Text text="{invoice2>Company}" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit" />

</m:HBox>

</layout:content>

</layout:Grid>

</m:Page>

But When i use the "ObjectPageLayout" Control then the output is not coming.

0

Hi Durga ,

I just saw you have I capital in content="{Invoice2>/UserDetails}"the objectpage layout code and the model name is invoice2 with i small .. is that the issue, just confirming ?

thanks

Viplove

0
Show more comments