on 07-29-2015 11:26 AM
Hello All,
Here is the correct Answer
what i done. I used a filter values in
xml view
---------------------------------------------------------------------------------------------------------------------------
<List id="list"
items="{/PO_APPROVALEKKKOset?$filter=Ivappid eq 'ZMOB_PO' and Ivmodid eq 'PO_APPROVL' and Ivsmodid eq 'PO_APPROVL' and Userid eq 'VBHANOT'}"
mode="{deviceId>/listMode}"
select="handleSelect"
growing="true"
growingScrollToLoad="true">
---------------------------------------------------------------------------------------------------------------------------
On Controller
_pushNewOrders: function () {
var oView = this.getView();
var oData = oView.getModel().read("/PO_APPROVALEKKKOset",null,["$filter=Ivappid eq 'ZMOB_PO' and Ivmodid eq 'PO_APPROVL' and Ivsmodid eq 'PO_APPROVL' and Userid eq 'VBHANOT'"], false);
},
-------------------------------------------------------------------------------------------------------------------------------
Output:
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the actual OData request being sent in your browser's network tab? Does it also receive a valid response there?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes I am not seen any data on list
here i am binding the result..
------------------------------------------------------------------------------------------------------------
onBeforeRendering: function() { | |
alert("123"); | |
var temp = (sap.ui.getCore().getModel("OdataModel")); | |
alert(temp); | |
this.getView().setModel(sap.ui.getCore().getModel("i18n"),"i18n"); | |
// | this.getView().setModel(sap.ui.getCore().getModel("deviceId"),"deviceId"); |
this.getView().setModel(sap.ui.getCore().getModel("OdataModel")); |
},
// update list binding
var list = this.getView().byId("list");
var binding = list.getBinding("items");
binding.filter(oFilters);
},
_pushNewOrders: function () {
var oView = this.getView();
var oData = oView.getModel().read("/PO_APPROVALEKKKOset", null,[ "$filter=Ivappid eq 'ZMOB_PO' and Ivmodid eq 'PO_APPROVL' and Ivsmodid eq 'PO_APPROVL' and Userid eq 'VBHANOT'"], false);
},
handleRefresh: function (oEvent) {
setTimeout(jQuery.proxy(function () {
this._pushNewOrders();
// Deal with any actual search query
alert("hello");
var oList = this.getView().byId("list");
var oSearchField = this.getView().byId("searchField");
var sQuery = oSearchField.getValue();
var aFilters = [];
if (sQuery && sQuery.length) {
// aFilters.push(new sap.ui.model.Filter("Vbeln", sap.ui.model.FilterOperator.Contains, sQuery));
aFilters.push(new sap.ui.model.Filter("PO_number", sap.ui.model.FilterOperator.EQ, sQuery));
}
oList.getBinding("items").filter(aFilters);
}, this), 1000);
},
---------------------------------------------------------------------------------
Again, I repeat my question, where do you store the results from your read() operation? Remember, as the API also points out,
The data will not be stored in the model. The requested data is returned with the response.
What I'm missing is how you handle the 'response' results from the ODataModel.read() success handler?
Hello Robin,
Here we are read the response
// update list binding
var list = this.getView().byId("list");
var binding = list.getBinding("items");
binding.filter(oFilters);
},
_pushNewOrders: function () {
var oView = this.getView();
var oData = oView.getModel().read("/PO_APPROVALEKKKOset", null,[ "$filter=Ivappid eq 'ZMOB_PO' and Ivmodid eq 'PO_APPROVL' and Ivsmodid eq 'PO_APPROVL' and Userid eq 'VBHANOT'"], false);
},
handleRefresh: function (oEvent) {
setTimeout(jQuery.proxy(function () {
this._pushNewOrders();
ODataModel.read returns not data but
@return {object} an object which has an <code>abort</code> function to abort the current request.
return oRequestHandle;
as suggested, you dont have success handler, you can pass it as 4th parameter
mUrlParams = arguments[2];
bAsync = arguments[3] !== false; // Defaults to true...
fnSuccess = arguments[4];
fnError = arguments[5];
I have really no idea what you are doing... The return value for the model.read() operation is
an object which has an abort
function to abort the current request
of which you do nothing, but you also do not specify any success/error handler? Have you taken a look at the API for ODataModel.read()?
It clearly says:
Trigger a GET request to the odata service that was specified in the model constructor. The data will not be stored in the model. The requested data is returned with the response.
So again, where do you handle the response? I would have expected something like this:
_pushNewOrders: function () {
var oView = this.getView();
oView.getModel().read(
"/PO_APPROVALEKKKOset",
null,
[ "$filter=Ivappid eq 'ZMOB_PO' and Ivmodid eq 'PO_APPROVL' and Ivsmodid eq 'PO_APPROVL' and Userid eq 'VBHANOT'"],
true,
function(oData, oResponse) {
//Here I would have expected something you would do with the received data
},
function(oError) {
}
);
},
However, somehow I think you could use a better approach than using read():
_pushNewOrders: function () {
var oList = this.getView().byId("list"),
sURI = "http://whateveryourserviceurlis/",
oModel = new sap.ui.model.odata.ODataModel(sURI,false),
oBinding = oModel.bindList("PO_APPROVALEKKKOset"),
oFilter = new sap.ui.model.Filter("Ivappid", sap.ui.model.FilterOperator.Equals, "ZMOB_PO");
oBinding.filter([
new sap.ui.model.Filter("Ivappid", sap.ui.model.FilterOperator.Equals, "ZMOB_PO"),
new sap.ui.model.Filter("Ivmodid", sap.ui.model.FilterOperator.Equals, "PO_APPROVL"),
new sap.ui.model.Filter("Ivsmodid", sap.ui.model.FilterOperator.Equals, "PO_APPROVL"),
new sap.ui.model.Filter("Userid", sap.ui.model.FilterOperator.Equals, "VBHANOT"),
]);
oList.setModel(oModel);
},
Hello Robin,
check this code we are doing on login controller. i already mention on 1st post.
Can u clarify me where i am doing wrong?
oModel.read("/PO_APPROVALEKKKOset", null,["$filter=Ivappid eq 'ZMOB_PO' and Ivmodid eq 'PO_APPROVL' and Ivsmodid eq 'PO_APPROVL' and Userid eq 'VBHANOT'"], false,
function(oData, response)
{
sap.ui.getCore().setModel(oModel,"OdataModel");
var oApp = sap.ui.getCore().byId("App");
oApp.to("SApp");
},
function(oData, response)
{
jQuery.sap.require("sap.ca.ui.message.message");
sap.ca.ui.message.showMessageBox({
type: sap.ca.ui.message.Type.ERROR,
message: "Service connection couldn't be established",
details: "Error" + " " +
oData.message+" : "+
oData.response.statusCode+" : "+
oData.response.statusText
});
return;
});
}
C'mon, haven't you read my previous post?? I showed you what is wrong with your code!
ok, again, take a look at this:
oModel.read("/PO_APPROVALEKKKOset", /* etc */,
function(oData, response) {
sap.ui.getCore().setModel(oModel,"OdataModel");
var oApp = sap.ui.getCore().byId("App");
oApp.to("SApp");
},
Now, tell me, where in your success handler are you using either 'oData' or 'response' ??
Exactly, nowhere.
So the data you retrieved by the 'read()' operation is stored nowhere.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.