Quantcast
Channel: SCN : Popular Discussions - ABAP in Eclipse
Viewing all articles
Browse latest Browse all 1215

OData and SAPUI5 connection

$
0
0

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 ]

            });

        }


Viewing all articles
Browse latest Browse all 1215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>