Skip to Content
0

SAPUI5 Value Help data binding

Jan 29, 2017 at 12:47 PM

126

avatar image
Former Member

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

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

2 Answers

Best Answer
Veeraraghavan Narasimhan
Jan 29, 2017 at 07:01 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Jun Wu Jan 29, 2017 at 01:41 PM
0
sap.ui.getCore().setModel(oModel)
Share
10 |10000 characters needed characters left characters exceeded