cancel
Showing results for 
Search instead for 
Did you mean: 

Aggregation binding path problem

eyup_aksoy
Explorer
0 Kudos
1,647

Hi all,

How can I bind array data to popup? What is path?

Accepted Solutions (1)

Accepted Solutions (1)

Qualiture
Active Contributor
0 Kudos

Looking at your structure, I think the binding path for aggregation 'items' should be {/d/results}

However, it seems like you stored OData response in an JSONModel. Why not use an ODataModel instead?

eyup_aksoy
Explorer
0 Kudos

hi robin I tried your way not working. Why not jsonModel

Qualiture
Active Contributor
0 Kudos

Impossible, it should be working.

But you do have assigned the controller AND the model to your SelectDialog upon opening, right?

showDialog : function(oEvent) {

    if (! this._oDialog) {

        this._oDialog = sap.ui.xmlfragment("my.demo.fragments.SelectDialog", this);

        this._oDialog.setModel(this.getView().getModel());

    }

    this._oDialog.open();

}

Edit: Well, why not an ODataModel? If you're working with OData, I would assume it makes more sense using an ODataModel

eyup_aksoy
Explorer
0 Kudos

Yes I did. When I was press value help like;


Then




Qualiture
Active Contributor
0 Kudos

See this working demo: Plunker

Qualiture
Active Contributor
0 Kudos

If you open the Select Dialog, and then press Shift-Alt-Ctrl-S, and browse the control tree to your SelectDialog, check the binding info for this control and the child StandardListItems. Am pretty sure it will show errors

eyup_aksoy
Explorer

Thanks robin it's woked. Wrong line is 

sap.ui.getCore().setModel(oModel);  // Wrong

this.getView().setModel(oModel);    // True

former_member182372
Active Contributor
0 Kudos

Robin, btw, instead of

this._oDialog = sap.ui.xmlfragment("my.demo.fragments.SelectDialog", this);

this._oDialog.setModel(this.getView().getModel());

i would do

this._oDialog = sap.ui.xmlfragment("my.demo.fragments.SelectDialog", this);

this.getView().addDependent(this._oDialog);

addDependent will propagate all the models and binding contexts (especially handy when you have more than one model) and when the view is destroyed by

sap.ui.core.UIComponent.prototype.destroy.apply(this, arguments);

that aggregation will be destroyed too, that is especially useful when component is embedded into FLP and user relaunches the app from tile. Without addDependent we would need to destroy _oDialog explicitly in destroy method of component or by second launch sap.ui.xmlfragment will throw the duplicate ID exception (because _oDialog is still in the core which is still the same for FLP)

Qualiture
Active Contributor
0 Kudos

Maksim, you are ab-so-lu-tely right -- as always 'addDependent' is the preferred way indeed

Answers (1)

Answers (1)

Private_Member_15166
Active Contributor
0 Kudos

IF you are using SAP Gateway then in place of Path put entitySet name.

Let's suppose from this link this is my JSON URL.

http://services.odata.org/V4/Northwind/Northwind.svc/Products?$format=json

then i will write /value in place of my path.

value: [

  • {
    • ProductID: 1,
    • ProductName: "Chai",
    • SupplierID: 1,
    • CategoryID: 1,
    • QuantityPerUnit: "10 boxes x 20 bags",
    • UnitPrice: 18,
    • UnitsInStock: 39,
    • UnitsOnOrder: 0,
    • ReorderLevel: 10,
    • Discontinued: false
    },
eyup_aksoy
Explorer
0 Kudos

Like this? Not working

<SelectDialog

     noDataText="No Data"

     class="sapUiPopupWithPadding"

         items="path:'/activitiesSet'}"

     <StandardListItem

       title="{Monat}"

       description="" />

   </SelectDialog>

Private_Member_15166
Active Contributor
0 Kudos

Like this.

  items="{
  path: '/activitiesSet'
  }"


eyup_aksoy
Explorer
0 Kudos