Skip to Content
avatar image
Former Member

SAPUI5 Value Help data binding

Hi,

could you please help with this issue regards value help dialog? My code looks as follows: (based on the UI5 Explored)

Component.js:

// Create and set domain model to the component
var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, {
json: true,
loadMetadataAsync: true
});
this.setModel(oModel);

In the controller:

    oValueHelpDialog.getTable().setModel(sap.ui.getCore().getModel("oModel"));

//var oRowsModel = new sap.ui.model.json.JSONModel();
//oRowsModel.setData(this.aItems);
//oValueHelpDialog.getTable().setModel(oRowsModel);
if (oValueHelpDialog.getTable().bindRows) {
oValueHelpDialog.getTable().bindRows("/SoldToSearchSet"); 
}

I do not get any data visible, what is wrong with my databinding?

Thanks,

Tim

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 29, 2017 at 07:01 PM

    Hello Tim,

    You have set the model on the component but while accessing you are the global ui5core model and therefore not visible. In the controller you have reference to the Owner Component.

    Another option is to set global model by using sap.ui.getCore().setModel() -- But this is strictly not recommended.

    The solution is - In controller file

    oValueHelpDialog.getTable().setModel(this.getOwnerComponent().getModel("oModel"));

    This way you will be able to have the component's model set to value help table. Hope this helps.

    Thanks and Regards,

    Veera

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 29, 2017 at 01:41 PM
    sap.ui.getCore().setModel(oModel)
    Add comment
    10|10000 characters needed characters exceeded