Skip to Content
avatar image
Former Member

How to Bind Odata about Smart Filter Bar

Thank you!~

I want to bind odata service,but in explored and demo app,Both these are bind "mock server",not odata.

this is my controller code:

sap.ui.controller("MM_REPORT.controller.TableDisp", {


	onInit: function() {


		var oModel, oView;
		var othis = this;


		oModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/ZSD_RE0001_SRV/", true);
		oModel.setCountSupported(false);
		oView = this.getView();
		oView.setModel(oModel);


		oModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/ZSD_RE0001_SRV/", {
			json: true,
			loadMetadataAsync: true
		});
		oModel.read("/ZFIORI_SD0001SSet", {
			context: othis,
			success: function(odata, response) {
				console.log("odata数据...");
				console.log(odata.results);
				var oXMLModel = new sap.ui.model.xml.XMLModel(odata);
				var oJSONModel = new sap.ui.model.json.JSONModel(OData);
				oJSONModel.oData = odata.results;
				oModel.oData = odata.results;
				othis.getView().setModel(oModel);


				var oSmartTable = othis.getView().byId("smartTable");
				oSmartTable.setModel(oXMLModel);
				var oSmartFilterbar = othis.getView().byId("smartFilterBar");
				oSmartFilterbar.setModel(oXMLModel);


			},
			error: function(oError) {
				console.log(oError);
			}
		});


	},
	onExit: function() {},
});
<br>

my sap ui version is 1.28.23 .

I'm a beginner, so Pls give me an as detailed as possible answer !~

thank you very much!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers