cancel
Showing results for 
Search instead for 
Did you mean: 

Aggregation binding path problem

eyup_aksoy
Explorer
0 Kudos
1,651

Hi all,

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

View Entire Topic
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