0 evaluări0% au considerat acest document util (0 voturi)
2K vizualizări3 pagini
The document discusses how to pass select and filter parameters to the ODataModel.read function in SAPUI5. Sarath Chandra provides an example of creating filter and urlParameter objects and passing them to the read method via a parameters object. The filter object is created by looping through filter IDs and values to generate Filter instances. Oliver confirms this helps answer his question.
The document discusses how to pass select and filter parameters to the ODataModel.read function in SAPUI5. Sarath Chandra provides an example of creating filter and urlParameter objects and passing them to the read method via a parameters object. The filter object is created by looping through filter IDs and values to generate Filter instances. Oliver confirms this helps answer his question.
The document discusses how to pass select and filter parameters to the ODataModel.read function in SAPUI5. Sarath Chandra provides an example of creating filter and urlParameter objects and passing them to the read method via a parameters object. The filter object is created by looping through filter IDs and values to generate Filter instances. Oliver confirms this helps answer his question.
ODataModel.read: pass select and filters Jun 27, 2015 1:10 PM Hi! How is it possible to pass a select parameter and filters to the ODataModel.read function? I found this example in the SAP help: oModel.read('/Products(1)', null, null, true, function(oData, oResponse){ alert("Read successful: " + JSON.stringify(oData)); },function(){ alert("Read failed");});
However isn't it contracdicting to the API?:
JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.odata.ODataModel
Thanks for your help!
Oliver Tags: parameter, odata, select, read, filters
Sarath Chandra 148 posts since Oct 1, 2009
Re: ODataModel.read: pass select and filters Jun 27, 2015 2:52 PM // Creating a filter object so preparing arrays for Ids and Values separately. aFilterIds = ["sProductId"]; aFilterValues = [sProductIdValue]; // once the Id and Values are prepared separately, dynamically prepare the filter object by calling below method. aFilters = this._createSearchFilterObject(aFilterIds, aFilterValues); //Build the Parameters required for the Read method. var mParameters = { filters : aFilters, urlParameters:{"$select" : "Category,ProductName", "$expand" : "Category" } success : function (oData) {
}.bind(this), error: function (oError) { jQuery.sap.log.info("Odata Error occured"); }.bind(this) }; // As the parameters is build, start calling read method with sPath and mParameters. if (oModel) { oModel.read(sPath, mParameters); }
// method to create different filters.(modify according to ur requirement.)
/** * Assign the filter objects based on the input selection * * @function * @param {Array} aFilterIds to be used as sPath for Filters * @param {Array} aFilterValues for each sPath * @private */ Controller.prototype._createSearchFilterObject = function (aFilterIds, aFilterValues) { var aFilters = [], iCount;
Re: ODataModel.read: pass select and filters Jun 27, 2015 3:44 PM Perfect, thanks for your help!
indrajith patel 351 posts since Nov 10, 2014
Re: ODataModel.read: pass select and filters Jun 27, 2015 3:33 PM Maybe this helps. Filter Support for (sap.ui.model.odata.ODataModel).read(...) Function