Skip to Content

how to bind rows with dynamic json data?

Sep 13, 2017 at 09:40 AM


avatar image

I have tried this

var oTable= this.getView().byId("tstable");

var date= this.getView().byId("DP1").getValue();

var to = this.getView().byId("to").getValue();

var typ = this.getView().byId("typ").getValue();

var frm = this.getView().byId("frm").getValue();

var prj = this.getView().byId("prj").getValue();

var des = this.getView().byId("des").getValue();

var jModel= new sap.ui.model.json.JSONModel();

var data = {d: {

date: date,

from: "",

to: "",


customer: "",

project: "",

internal: "",

description: "" }};



oTable.bindRows("/data"); },


the error in the console is "oTable.bindRows is not a function"

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

3 Answers

Best Answer
avatar image
Former Member Sep 13, 2017 at 01:48 PM

Is this sap.m.Table or sap.ui.table.Table?

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

its a .m table


Hi Tridwip Das

If its sap.m table than there is no method known as bindRows it has bindItems ... Actually sap.m.table is designed as list which has the aggregation items not rows where as the sap.ui.table is designed as proper tables with rows and columns both as aggregations .. please refer api reference of table :

Tip :

And also a tip for you after seeing your code in the query : don't get values the way you are doing currently like for getting date you are getting the value of the control date (this.getView.byId("DP1")) instead of that use models (json model) ..

Through models you will always get the updated values whereas getting values by control id will give you the value attach to the control which will be static even if the values gets changed ..


Viplove khushalani


thank you sir. yet I have another question about this table matter. may I ask? Thank you!


Actually sir I have some input fields through which user would input values and the same should be written in table. It is a timesheet table and thats why I need to take input from users. The problem now is that the entered values are replacing but not concatenating to rows.


tab.png I need to update those rows not replace

tab.png (137.7 kB)
Sharath M G Sep 14, 2017 at 02:56 AM

You must be using the sap.m.table. You need to use bindItems and not bindRows.

10 |10000 characters needed characters left characters exceeded
Joseph BERTHE Sep 13, 2017 at 04:06 PM

uhm, your JSon is not rigth, it is not an Array ;) Furthermore, the path on your Binding is wrong it should be this :

oTable.bindRows("/"); },

If you do not want to modify your binding, your JSon should be this :

{ data : [ { date : '', from : '', ...}, { date : '', from : '', ...}, ... ]}


10 |10000 characters needed characters left characters exceeded