$(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 bind data to a Grid/StandardListItem

Jan 04, 2017 at 09:31 PM

48

avatar image
Former Member

I have a list of StandardListItem elements under a Grid and would like to bind them to a json file using a json model.

This is how I do the binding in my controller

var pricingModel = new JSONModel("./model/evaluation.json");

//set model(s) to current xml view
this.getView().setModel(pricingModel, "pricingModel");

This is a snippet of my xml view where I'm trying to bind my data.

<l:Grid class="sapUiSmallMarginTop"
        id="priceEvalGridContainer" visible="false"
        binding="{/PriceEstimate}">
<l:content>
    <l:VerticalLayout id="priceEvalCol1" width="100%">
        <StandardListItem  title="NSN"
                           info="{NSNID}"/>
        <StandardListItem  title="DLA Price Estimate (DLA)"
                           info="{DLAPriceEstimate}"/>
        <StandardListItem  title="Proposed Price"
                           info="$20.00" />
    </l:VerticalLayout>
    <l:VerticalLayout id="priceEvalCol2" width="100%">
        <StandardListItem  title="$ Difference From DLA" info="$1.50" />
        <StandardListItem  title="Total Price Difference" info="$135.00" />
        <StandardListItem  title="PPI Price Adjusted For Inflation" info="$18.59" />
</l:VerticalLayout>
</l:content>
</l:Grid>

I have hard-coded a lot of the values as I haven't been able to properly connect the data. The only items being tested for now are info="{NSNID}" and info="{DLAPriceEstimate}"

I've seen examples on how to bind a StandardListItem or a Grid, but haven't seen it being done together.

I tried doing the binding in the following way but it didn't work for me.

<l:Grid class="sapUiSmallMarginTop"
        id="priceEvalGridContainer" visible="false"
        binding="{
                 path: '/PriceEstimate'
                  }">

The app runs with no problems and there are no errors being shown, however the data does not show up in the grid. It's all blank.

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

0 Answers