cancel
Showing results for 
Search instead for 
Did you mean: 

Creating JSView with viewContent without ViewName

Former Member
0 Kudos
70

Hi,

We want to create JSView when we are having viewContent as string. For this we don't have viewName, neither we want to create view file for the same. Can we create jsView with such condition?

var oView = sapui.view({

  viewName     : "AppView",               // we don't want to pass viewName

viewContent  : sJSContent,             // we want to create view by passing this only

  type               : sapui.core.mvc.ViewType["JS"]

  });

Can we do something like that?

Thanks & Regards,

Rhythm

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

can you tell us what you are trying to do??

Former Member
0 Kudos

I want to create view by passing viewType and viewContent, where viewContent is having sapui5 controls in it.

I am able to get view for viewType "XML" but unable to do same for JS.

For instance,

sXMLContent = "<mvc:View xmlns:html=\"http://www.w3.org/1999/xhtml\"

xmlns:mvc=\"sap.ui.core.mvc\"

xmlns=\"sap.m\"

controllerName=\"Sample1.controller.View1\">

<App>

<pages>

<Page title=\"{i18n>title}\">

<content>

<Button text=\"Button\" width=\"100px\" id=\"__button\"/>

</content>

</Page>

</pages>

</App>

</mvc:View>"

var oView = sapui.view({

  viewContent  : sXMLContent,             // Passing string over here

  type                 : sapui.core.mvc.ViewType["XML"]

  });

From here i am able to get oView object.

But for corresponding JS content, passing viewContent and type to create view is not sufficient what it says.

Let me know in case of further information required.

junwu
Active Contributor
0 Kudos

what's point of doing this?