jQuery.sap.require("sap.ui.table.Table");
jQuery.sap.require("sap.ui.table.SelectionMode");
// controller part , set models
sap.ui.controller("myController", {
onInit: function () {
var oModel = new sap.ui.model.odata.ODataModel("proxy/http/services.odata.org/V3/(S(hwii2w0uoa1wgczn3bian230))/OData/OData.svc/");
oModel.oHeaders = {
"DataServiceVersion" : "3.0", // first check the oModel data version, since we are using data version 3 in the
// in the service URL that we are accessing, we set out oModel version from 2 to 3
"MaxDataServiceVersion": "3.0" // if not we get an error
};
/*
console.log(oModel);
this.getView().setModel(oModel);*/
var oSCNJSon = new sap.ui.model.json.JSONModel();
oModel.read("/Products", null, null, false, function(oData, oResponse){
var otable = sap.ui.getCore().byId("tableid");
oSCNJSon.setData(oData);
otable.setModel(oSCNJSon,"SCNModel");
});
}
});
//View
sap.ui.jsview("myView", {
getControllerName: function () {
return "myController";
},
createContent: function (oController) {
var oTable = new sap.ui.table.Table("tableid", {
selectionMode : sap.ui.table.SelectionMode.Multi,
selectionBehavior: sap.ui.table.SelectionBehavior.Row,
//navigationMode : sap.ui.table.NavigationMode.ScrollBar,
visibleRowCount : 3,
});
oTable.addColumn(new sap.ui.table.Column({
label : new sap.m.Label({text : "ID"}),
template : new sap.m.Text({text : "{SCNModel>ID}"}),
}));
oTable.addColumn(new sap.ui.table.Column({
label : new sap.m.Label({text : "Name"}),
template : new sap.m.Text({text : "{SCNModel>Name}"}),
}));
oTable.addColumn(new sap.ui.table.Column({
label : new sap.m.Label({text : "Description"}),
template : new sap.m.Text({text : "{SCNModel>Description}"}),
}));
oTable.addColumn(new sap.ui.table.Column({
label : new sap.m.Label({text : "ReleaseDate"}),
template : new...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.