RE: OData and SAPUI5 connection

      Hello all,

                 I am new in sapui5 and I don’t know how to map the data.I have done frontend designing and Odata configuration.Now I want to display the data in a valuehelp.I dont know whether i m doing it right or wrong.Please guide me.My code is as below.

      Thanks in Advance

      Application.js

      sap.ui.app.Application.extend(“Application”, {

        init: function() {

      //  Call all your OData Service here. for example:

           

            this.metadataUrl = “proxy/sap/opu/odata/sap/ZCALL_CENTER_SRV/”;

            sap.ca.common.uilib.Ajax.registerModelUrl(

                       “/sap/opu/odata/sap/ZCALL_CENTER_SRV/”,

                       “proxy/sap/opu/odata/sap/ZCALL_CENTER_SRV/”);

               this.oDataModel = new sap.ui.model.odata.ODataModel(this.metadataUrl,true);

               this.oDataModel.setCountSupported(false);

               sap.ui.getCore().setModel(this.oDataModel);

      },

      homepage.view.xml

      <HBox alignItems=”Center” id=”hBox1″>

                      <Label id=”l1″ width=”150px” labelFor=”i1″ design=”Bold” required=”true” text=”Enter Plant”/>

                      <Input id=”i1″ valueHelpRequest=”handleValueHelp1″ showSuggestion=”true” showValueHelp=”true” placeholder=”Plant..”

                             type=”Text”/>

                      </HBox>

      homepage.controller.js

      onInit: function() {

              plantData = “/PlantSet”;

                          this.getView().byId(“i1”).bindAggregation(“suggestionItems”, plantData,

                              new sap.ui.core.Item({

                              text : {parts: [{path:’CUST_ID’,formatter:function(sValue){return sValue+”:”;}}, {path:’Name1′}]},

                              key : “{CUST_ID}”

                                         })

                          );

       

      handleValueHelp1: function(oEvent)

          {   

              if (!this._valueHelpDialog) {

                  this._valueHelpDialog = new sap.m.SelectDialog({

                      title : “Plants”,

                      items : {

                          path : plantData,

                          template : new sap.m.StandardListItem({

                              title : “{CUST_ID}”,

                              description : {parts: [

                                               {path:’CUST_ID’,formatter:function(sValue){return sValue+”:”;}},

                                               {path:’Name1′}

                                              ]},

                          }).addStyleClass(“dialog1-dialog-title”)

                  },

                  search : [ this._handleValueHelpSearch, this ],

                  confirm : [ this._handleValueHelpClose, this ],

                  cancel : [ this._handleValueHelpClose, this ]

                  });

              }

      handleValueHelp1: function(oEvent)

          {   

              if (!this._valueHelpDialog) {

                  this._valueHelpDialog = new sap.m.SelectDialog({

                      title : “Plants”,

                      items : {

                          path : plantData,

                          template : new sap.m.StandardListItem({

                              title : “{CUST_ID}”,

                              description : {parts: [

                                               {path:’CUST_ID’,formatter:function(sValue){return sValue+”:”;}},

                                               {path:’Name1′}

                                              ]},

                          }).addStyleClass(“dialog1-dialog-title”)

                  },

                  search : [ this._handleValueHelpSearch, this ],

                  confirm : [ this._handleValueHelpClose, this ],

                  cancel : [ this._handleValueHelpClose, this ]

                  });

              }

      Hi,   Check this blog : How to Implement Value Help (F4) with SAP UI5 . This will help you.   @moderator: Please move this to UI5 space.     Regards, Kiran

      User Rating: Be the first one !
      Mark Setchell Supporter Asked on November 2, 2016 in eclipse.
      Add Comment
      1 Answers

        Hi,

         

        Check this blog : How to Implement Value Help (F4) with SAP UI5 . This will help you.

         

        @moderator: Please move this to UI5 space.

         

         

        Regards,

        Kiran

        Add Comment

        Your Answer

        By posting your answer, you agree to the privacy policy and terms of service.