on 12-16-2015 12:38 PM
Hello Everyone,
I tried to bind odata with my table but it doesnt bind any give no Data.
My webservice url is : http://********:***/sap/opu/odata/sap/ZCRAVE_WO_DETAILS_SRV/WoHeaderDtlSet?$filter=User eq 'SAPUSER' and ZappId eq 'ZMOB_WO' and ZmodId eq 'ZMOB_WO' and ZsmodId eq 'ZMOB_WO'
My table.view.js file code:
createContent: function(oController) {
//Create an instance of the table control
var oPage = new sap.m.Page({
title: "Company Details"
});
var oTable = new sap.m.Table({
id : "Table1",
columns: [
new sap.m.Column({
width: "1em",
header: new sap.m.Label({
text: "OrderNo."
})
})
]
});
var template = new sap.m.ColumnListItem({
id : "first_template1",
type: "Navigation",
visible: true,
selected: true,
cells: [
new sap.m.Label({
text: "{Plant}" //property in my web service
})
]
});
var oFilters = null;
oPage.addContent(oTable);
return oTable;
}
table.controller.js code is:
onInit: function() {
var oModel = new sap.ui.model.odata.ODataModel( "proxy/http/****:****/sap/opu/odata/sap/ZCRAVE_WO_DETAILS_SRV");
//Set the Model to the Table
var oTable = sap.ui.getCore().byId("Table1");
oTable.setModel(oModel);
// Filter the DATA
var FilterOperator = sap.ui.model.FilterOperator;
console.log(FilterOperator);
var filter = new sap.ui.model.Filter("Orderid",FilterOperator.EQ, "000004000000");
console.log(filter);
//Bind the Data to the Table
oTable.bindItems("/WoHeaderDtlSet",sap.ui.getCore().byId("first_template1"), null, filter);
}
i also added routes in neo-app.json file:
{
"path": "/sap/opu/odata/sap",
"target": {
"type": "destination",
"name": "devcenter",
"entryPath": "/sap/opu/odata/sap"
},
"description": "SAP dev center"
}
But i didnt get any output in table .
I am stuck with this problem .
Can anyone please help me how to solve this problem.
Hi,
In addition to Maksim´s post I would suggest:
- check the console output in your browsers dev tools
- add the following events to your model to see what´s going on:
oModel.attachMetadataFailed(function() {
jQuery.sap.log.debug("metadata failed");
}, this);
oModel.attachRequestCompleted(function(oData) {
jQuery.sap.log.debug("request completed");
});
oModel.attachMetadataLoaded(function() {
jQuery.sap.log.debug("metadata loaded");
});
If event RequestCompleted is called (set a breakpoint; usually it´s called async) and you have data in oData variable and still the UI is empty there is an issue with the binding (syntax).
Best regards,
Sebastian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you are using destination, there is no need to use proxy and server name
remove
"proxy/http/****:****/
from ODataModel constructor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kishan,
Please try with this..
var url1=""proxy/http/****:****/sap/opu/odata/sap/ZCRAVE_WO_DETAILS_SRV";
var omModel1=new sap.ui.model.odata.ODataModel(url1,true);
oView.setModel(oModel1,"TableDataModel");
and map the table data like this..
cells: [
new sap.m.Label({
text: "{TableDataModel>Plant}" //property in my web service
})
]
regards,
Kuldeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.