Skip to Content
0

binding the OData based model to the fields of the view.

Mar 16 at 05:45 AM

187

avatar image

Hi all,

I am just trying to bind the data taken from an OData service with the View of the sapui5.

But there is some binding issue as the data is not visible on the view.

Here is the Controller section.capturecare1.png

this is way I binded the model with the fields of the view.capturecare2.png

The format of data is:capturecare3.png

despite of getting the data, I am not able to view it on the table.

Please suggest me something for the same.

Thanks and Regards,

Aakanksha Gupta

capturecare1.png (9.0 kB)
capturecare2.png (30.1 kB)
capturecare3.png (9.2 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Akhilesh Upadhyay Mar 16 at 07:00 AM
0

try using bindRows and remove items property from the table declaration (i.e. items: "{path: model1>/DLSet}")

oTable.setModel(your model);
oTable.bindRows ("model1>/DLSet");

hope this help.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Akhilesh,

Thank you for the help.

But it is not working for it as well. I tried this as well.

I tried to print the value of the model in the view using console command.

But the value is undefined.

data is visible only at the controller end, but the value is not getting passed to the view.

Could you just suggest me a way of updating the value of any field using its controller.

Thanks and Regards,

Aakanksha Gupta

0

Hi Aakanksha,

you can check model.oData or model.getData() to read the data from model not value. well,

nothing major issue i can see, see example in below link and follow the same, hope very minor thing you might have missed out, may be you can set model to view instead of core what you have done.

Table binding , hope this help.

Thanks

0
VAIBHAV GB Mar 16 at 08:04 AM
0

In your code change "items" to "rows". it should be done.

var oTable = new sap.ui.table.Table({
rows:"{model1>/DLSet}"
});
Share
10 |10000 characters needed characters left characters exceeded
Shilpa Ramamurthy SAP Employee Mar 17 at 06:05 AM
0

Hi Akanksha,

sap.ui.table.table doesn't have aggregation called "items". It is "rows". Refer https://sapui5.hana.ondemand.com/#docs/api/symbols/sap.ui.table.Table.html#constructor

Regards,

Shilpa

Share
10 |10000 characters needed characters left characters exceeded