Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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;

    }

});

Former Member
Former Member replied

Hi Edukondalu

Please check this line


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


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

2 View this answer in context
Not what you were looking for? View more on this topic or Ask a question