Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8150

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

$
0
0

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.


Viewing all articles
Browse latest Browse all 8150

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>