Skip to Content

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

Syntax of 'Set' Functions

Hi everyone. I have been trying to create a view using 'SET' functions, but no luck. The code below works.

var lco_View = new sap.ui.view(

{    id: "Tasks",

    viewName: "zbc_ui5_app01.Tasks",

    type: sap.ui.core.mvc.ViewType.JS

});

lco_MasterShell.addContent(lco_View);

What is the equivalent using 'Set' Functions:

var lco_View = new sap.ui.view("Tasks");

lco_View.setViewName("zbc_ui5_app01.Tasks");

lco_View.setType(sap.ui.core.mvc.ViewType.JS);

lco_MasterShell.addContent(lco_View);

When I use this code, it gives me an error that 'View type not defined'. How do I get the syntax for 'Set' functions, is there a general rule of thumb. I cannot get the details in the API as well. Or alternatively, can i use the 'setProperty' Function?

Thanks in advance guys.

PS: there is no API reference for node 'SAP.UI.VIEW', is this an alias for another class?

Former Member
replied

Hi Jibran,

Here I've a working example:

http://jsbin.com/huhorixabe/edit?html,output

Think you have to switch the id and the name as in my example. Also used sap.ui.jsview instead of sap.ui.view.

Kind regards,

Wouter

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