Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3523

SAPUI5 Application Best Practises with Javascript Views

$
0
0

Hi,

 

I have followed the tutorial for the sapui5 "application best practises" that can be found in the following developer guide:

http://help.sap.com/hana/SAP_UI5_Developer_Guide_for_SAP_HANA_en.pdf

 

I was able to complete the tutorial without any problems.

 

Now I decided to do it again using javascript views, but two problems appeared.

 

I'm at the end of "Step 7: Model View Controller " at page 137 and encountered the following problems:

 

The "rootView" found in the component code forces me to use a XML view, can't we use a javascript view here?

This is where the path of the"App" view, containing the "splitApp" declaration, is placed.

In my code i have something like rootView : "tdg.view.App", and if i have an App.view.js it will always request for an App.view.xml, even if i force the path to be rootView : "tdg.view.App.view.js",.

 

tdg: project name

view: folder inside the WebContent, containing the views files

 

For the sake of trying to continue the project i went with the xml App view and used the code presented in the guide.

 

As told before, i want my views to be javascript so, the only place i found that needed to be changed was the following code in the Component.js:

 

routing : {

  config : {

    routerClass : tdg.MyRouter,

    viewType : "JS",

    viewPath : "tdg.view",

    targetAggregation : "detailPages",

    clearTarget : false

  },

 

Where before in the "viewType" was "XML", now I've changed it to "JS".

 

I have then created my Master.view.js and Master.controller.js files inside the view folder and tried to run the application with Google Chrome where it showed me an empty background just with the blue color and the following error appeared in the console:

 

Uncaught TypeError: undefined is not a function                                                                 UIComponent.js:6

 

And, running the application with Mozilla Firefox I get this error in the console:

 

TypeError: t.createContent is not a function                                                                          sap-ui-core.js line 80 > eval:6:1181

 

The error appears to be occurring in the line  "this.getRouter().initialize();" that is in the init function of the Component.js. If I remove it, then it lets me see the core structure of the SplitApp.

 

What is causing this error?

 

(I'm using Luna Eclipse in Windows 8)


Viewing all articles
Browse latest Browse all 3523

Trending Articles



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