How to retrieve table values in SAP UI5 Fiori


Define your table at view.js

 

var oTable = new sap.m.Table(“oTable”,{

growingScrollToLoad : true,

mode : sap.m.ListMode.MultiSelect,

width : “700px”,

columns : [

new sap.m.Column ({

   header : new sap.m.Label({

         text : “Col1”,

         design : “Bold”

   }),

   width : ‘150%’,

          resizable : false,

          flexible : false,

}),

new sap.m.Column ({

   header : new sap.m.Label({

         text : “Col2”,

         design : “Bold”

   }),

   width : ‘75%’,

          resizable : false,

          flexible : false,

}),

new sap.m.Column ({

   header : new sap.m.Label({

         text : “Col3”,

         design : “Bold”

   }),

   width : ‘175%’,

          resizable : false,

          flexible : false,

}),],

 

Retrieve data at controller.js

 

var oTable = sap.ui.getCore().byId(“oTable”);

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

oModel.attachRequestSent(function(){});

oModel.attachRequestCompleted(function(){});

var oParameters = {

“method” : “GET_TABLE_VALUES “};

oModel.loadData(“/zappname/”,oParameters);

oModel.setSizeLimit(999999);

oTable.setModel(oModel);

oTable.bindItems(“/”,

new sap.m.ColumnListItem({

type : sap.m.ListType.Navigation,

cells :

[

new sap.m.Input({

    value: ‘{val1}’}),

new sap.m.Label({

    text: “{val2}”,

    wrapping : false}),

new sap.m.Label({

    text: “{val3}”,

    wrapping : false}),

]

}));

 

Leave a comment

Your email address will not be published. Required fields are marked *