Skip to Content
avatar image
Former Member

Odata service data binding in HTML5

Hi Guys,

I have created the below view and am trying to execute but am getting the Server not found.

Kindly adjust , what suppose , we need do here.

sap.ui.jsview("exe_ui.CustomerData", {

    /** Specifies the Controller belonging to this View.

    * In the case that it is not implemented, or that "null" is returned, this View does not have a Controller.

    * @memberOf exe_ui.CustomerData

    */

    getControllerName : function() {

        return "exe_ui.CustomerData";

    },

    /** Is initially called once after the Controller has been instantiated. It is the place where the UI is constructed.

    * Since the Controller is given to this method, its event handlers can be attached right away.

    * @memberOf exe_ui.CustomerData

    */

    createContent : function(oController) {

       

        var oLayout = new sap.ui.commons.layout.MatrixLayout();

         var urconn = new "http://54.227.242.84/Ed_Demo/Services/Customer.xsodata";

        var oModel = new sap.ui.model.odata.ODataModel(urconn, false,"HNLR_VIJAY","Sainath1234");

       

        var arrayHeaders = new Array();

        var oControl;

        oTable = new sap.ui.table.Table("test",{tableId: "tableID",

          visibleRowCount: 4});

        oTable.setTitle("Customer Details");

       

        //Table Column Definitions

      

        oControl = new sap.ui.commons.TextField().bindProperty("value","FIRST_NAME");

        oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"FIRST_NAME"}), template: oControl, sortProperty: "FIRST_NAME", filterProperty: "FIRST_NAME", width: "125px" })); 

        oControl = new sap.ui.commons.TextField().bindProperty("value","CITY");

        oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"City"}), template: oControl, width: "125px" }));

        oControl = new sap.ui.commons.TextField().bindProperty("value","COUNTRY");

        oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"Country"}), template: oControl, width: "125px" }));

          oControl = new sap.ui.commons.TextField().bindProperty("value","CUSTOMER_ID");

           oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"Customer ID"}), template: oControl, sortProperty: "CUSTOMER_ID", filterProperty: "CUSTOMER_ID", width: "125px" }));

         oTable.setModel(oModel);

        var sort1 = new sap.ui.model.Sorter("CUSTOMER_ID");

        oTable.bindRows("/Customer",sort1);

        var iNumberOfRows = oTable.getBinding("rows").iLength;

        oTable.setTitle("Customer" + " (" + iNumberOfRows + ")" );

       

       

        var displayPanel = new sap.ui.commons.Panel("dispPanel").setText('Customer Details');

        displayPanel.addContent(oTable);

        oLayout.createRow(displayPanel);

        return oLayout;

    }

});

pastedImage_0.png (72.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Dec 30, 2014 at 07:14 AM

    Hi Edukondalu

    Please check this line

    var urconn = new "http://54.227.242.84/Ed_Demo/Services/Customer.xsodata";
    


    Please remove the "new" keyword from this statement to make it to


    var urconn = "http://54.227.242.84/Ed_Demo/Services/Customer.xsodata";
    

    And just advice, please avoid giving away the username and password of your HANA Machine in a public forum like SCN.

    var oModel = new sap.ui.model.odata.ODataModel(urconn, false,"HNLR_VIJAY","Sainath1234");
    

    Thanks and Regards

    Shubhang

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 29, 2014 at 01:33 PM

    Well, the error message perfectly says it all, doesn't it? 😉

    So, does your application has the ./WebContent/exe_ui folder with a Customer.view.js file in it?

    Since your view is called CustomerData instead of Customer, I think that's where your error comes from.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Robin,

      Thanks for your reply. I have been changed and executed still am not getting.

      kindly suggest.

      Thanks.

      Br,

      Ed

      mvc.PNG (102.4 kB)