cancel
Showing results for 
Search instead for 
Did you mean: 

Odata service data binding in HTML5

Former Member
0 Kudos

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;

    }

});

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

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

Former Member
0 Kudos

Thank u , It is working fine

0 Kudos

Mention not

Shubhang Tiwari    

Answers (1)

Answers (1)

Qualiture
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Hi Robin,

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

kindly suggest.

Thanks.

Br,

Ed