cancel
Showing results for 
Search instead for 
Did you mean: 

How to bind data to a Grid/StandardListItem

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (0)