cancel
Showing results for 
Search instead for 
Did you mean: 

MVC in SAPUI5

Former Member
0 Kudos

Hi Experts,

I am stuck trying out MVC in SAPUI5.

Please help me figure out the issue with my code.

Code as below :

Index.html


<!DOCTYPE html>

<html><head>

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

    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>

    <title>test</title>

  

    <script id='sap-ui-bootstrap'

    src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"

    data-sap-ui-theme='sap_goldreflection'

    data-sap-ui-libs='sap.ui.commons,sap.ui.table'></script>

  

    <script id='sap-ui-bootstrap'

    src='mvc.js'></script>

    </head>

    <body class='sapUiBody'>

        <div id='content'></div>

        <div id='table'></div>

    </body>

</html>

Please find the JS in the text file attached.

Thanks and Regards,

Rajanag

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184238
Participant
0 Kudos

Hi,

For example my project structure is like below.

We can call the controller in the project like below in index.html page.

<script>

  sap.ui.localResources("chart_nav_bar"); // Folder name in which our controller is placed

  var app = new sap.m.App({initialPage:"idnavbar1"});

  var page = sap.ui.view({id:"idnavbar1", viewName:"chart_nav_bar.navbar",

type:sap.ui.core.mvc.ViewType.JS});                   // Folder name and file name

  app.addPage(page);

   

  app.placeAt("content");

  </script>

It will help you.

Thanks&Regards

Sridevi

Former Member
0 Kudos

Hi Sridevi,

Thanks for your reply.

I tried out the same but I was unable to generate the view.

Thanks and Regards,

Rajanag

former_member184238
Participant
0 Kudos

Hi,

We have sample application in SAPUI5 demo kit which is following MVC architecture.

Download UI5 demokit by following the path and unzip the file .

In that please follow the below path to get the source code

HTML5Evaluation_complete_1.16.3\sapui5-sdk-static\test-resources\sap\m\demokit\mvc

Thanks&Regards

Sridevi

Former Member
0 Kudos

Hi Sridevi,

The link helped me.

Thanks.

Regards,

Rajan