cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 application error "object has no method 'createContent' "

Former Member
0 Kudos

Hi all,

I'm trying to deploy a simple application in SAP HANA cloud local runtime. The application displays a simple form. I have the createContent method in view.js file.

But when I run the application in the Local runtime, I get the following error.

Uncaught TypeError: Object [object Object] has no method 'createContent' sap-ui-core.js:126

What could be the reason for this error? Please suggest me how I should proceed.

Regards,

Saranya

Accepted Solutions (1)

Accepted Solutions (1)

surendra_pamidi
Contributor
0 Kudos

Hi Saranya,

You might give wrong name in sap.ui.jsview....

You have to give name  as below..

"sap.ui.jsview("packagename.viewfilename", { ................................... "

Check the above one clearly...

Regards,

Surendra.

Former Member
0 Kudos

Hi Surendra,

sap.ui.localResources("simpleform");

  var view = sap.ui.view({id:"idpage11", viewName:"simpleform.page1", type:sap.ui.core.mvc.ViewType.JS});

  view.placeAt("content");

This is the code inside <script> in my index.html. The package name is simpleform and view file name is page1.view.js. Should I change it?

Thanks,

Saranya

surendra_pamidi
Contributor
0 Kudos

Hi Saranya,

No need to change there.

Check here


"sap.ui.jsview("packagename.viewfilename", { ................................... "

that you gave "simpleform.page1" in the place of "packagename.viewfilename" or not. This is in view file.

Former Member
0 Kudos

Hi Saranya,

    I try the scenario myself and it can run well. Here is the detail information:

    Project structure:

   

  index.html

<!DOCTYPE HTML>

<html>

    <head>

        <meta http-equiv="X-UA-Compatible" content="IE=edge">

        <script src="resources/sap-ui-core.js"

                id="sap-ui-bootstrap"

                data-sap-ui-libs="sap.ui.commons"

                data-sap-ui-theme="sap_goldreflection">

        </script>

        <!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required -->

        <script>

                sap.ui.localResources("simpleform");

                var view = sap.ui.view({id:"idpage11", viewName:"simpleform.page1", type:sap.ui.core.mvc.ViewType.JS});

                view.placeAt("content");

        </script>

    </head>

    <body class="sapUiBody" role="application">

        <div id="content"></div>

    </body>

</html>

js file

sap.ui.jsview("simpleform.page1", {

    /** 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 simpleform.page1

    */

    getControllerName : function() {

        return "simpleform.page1";

    },

    /** 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 simpleform.page1

    */

    createContent : function(oController) {

        alert("Hello world!");

    }

});

This can run successfully in both nwds and ie.

You can copy the url here to run it in IE(Keep the original tab open while running it in IE)

Hope this can give some help.

Best regards,

Aria

Former Member
0 Kudos

Hi Surendra,

I got it thanks!

I tried to add the Facet Filter (from SAPUI5 demokit) control in my page. It has a method called sap.ui.model.json.JSONModel. Do I have to include any library for this?

Thanks & Regards,

Saranya

surendra_pamidi
Contributor
0 Kudos

Hi Saranya,

sap.ui.ux3 library file is enough.

Former Member
0 Kudos

Hi Surendra,

I just added sap.ui.table library and it worked.

Thanks,

Saranya.

Answers (0)