Skip to Content
0
Former Member
Dec 12, 2014 at 11:09 PM

how to get length of table loaded from oData/JSON model

1738 Views

hi all,

i've a local JSON model data loaded into a sap.m.Table as below in onBeforeRendering function:

var oModel = new sap.ui.model.json.JSONModel(); oModel.loadData("model/model.json", null, true); this.getView().setModel(oModel);

and in my onAfterRendering function, i've below code:

alert("inside onAfterRendering"); oModel = this.getView().getModel(); var mLength = oModel.getProperty("/data/items/length"); alert(mLength);

and the alert gives me 'undefined', how do i get the total noof rows added to the table. rite its JSON.. but after that i'll have to move to oData model.

JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.json.JSONModel

as per the above api, i've set bAync as ture. even though i get undefined.

any quick way of getting the lenght of table loaded thru either JSON/oData models.