Skip to Content
0
Former Member
May 12, 2016 at 05:37 AM

Unable to display Table data

56 Views

Hi
I am trying to dynamically fetch a table data with labels
I am getting the Labels but the related data isn't showing up .
Here is my code : Please help me figure this out

count.xsjs output


[{"Col":"SCHEMA"},{"Col":"TABLE"},{"Col":"TOTAL_MEMORY"},{"Col":"MAIN_MEMORY"},{"Col":"LOADED"},{"Col":"COUNT"}]



COUNT1.xsjs is giving me the following output when i checked


[{"SCHEMA":"HANAHQ3","TABLE":"VBAP","TOTAL_MEMORY":"2646301448",
"MAIN_MEMORY":"2637786836","LOADED":"PARTIALLY","COUNT":"41350976"}]


if(typeof sap.ui.getCore().byId("Table1") != 'undefined')

{

sap.ui.getCore().byId("Table1").destroy();

}

else

{

}

var that=this;

var oTable = new sap.ui.table.Table("Table1",{

title: "Table Details" , visibleRowCount: 1 });

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

oModel.loadData("../services/count.xsjs?schemapsm="+schema+"&tablepsm="+table+"");

oModel.attachRequestCompleted(function(event){

var oModel=this.getData();

that.getView().setModel(oModel,"columns");

for (var int = 0; int < oModel.length; int++) {

oTable.addColumn(new sap.ui.table.Column({

label: new sap.ui.commons.Label({text:oModel[int].Col}),

template: new sap.ui.commons.TextView().bindProperty("text",oModel[int].Col),

}));

}

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

oModel1.loadData("../services/count1.xsjs?schemapsm="+schema+"&tablepsm="+table+"");

// sap.ui.getCore().setData(oModel);

oTable.setModel(oModel1);

oTable.bindRows("/",oTable );

that.getView().setModel(oModel1);

}

);

this.getView().byId("id").addContent(oTable);

},


This is how my table pops up

Attachments