My latest trick in UI5 has me one step closer to my dynamic screen. Today I figured out how to loop through the JSON model. Turns out, once I had things in place, not as bad as I thought.
var oModel = this.getView().getModel(“config”).getProperty(“/results”);
if (oModel.length > 0) {
for(var i = 0; i < oModel.length; i++) {
var obj = oModel[i];
console.log(oModel[i].Field);
}
some things to notice. When you set oModel, be sure to use the getProperty(“/X”); where X is the group name. For me it was results, but if you aren’t sure, just look in debug mode and you’ll see what it should be.
Beyond that, it’s pretty easy. I added the console statement in here, just so I could see in Debug that it was looping through my table.
Thanks for reading,
As always, thanks for reading and don't forget to check out our SAP Service Management Products at my other company JaveLLin Solutions,Mike