cancel
Showing results for 
Search instead for 
Did you mean: 

Extending JSView

Former Member
0 Kudos

Hi

I'm trying to create a BaseView class, and can't get it to work.

BaseView.js:

jQuery.sap.declare("view.BaseView");

sap.ui.core.mvc.JSView.extend("view.BaseView", {  ....methods....});

and then the view itself:


MyView.js:

jQuery.sap.require("view.ViewBase");

jQuery.sap.declare("view.MyView"); //also tried without this line

view.ViewBase.extend("view.MyView", { ....methods...});

This method works for BaseController class perfectly.

But for view extension I get "undefined is not a function".

I did lots of tries, also with sap.ui.jsview();

no luck.

anyone?

Accepted Solutions (0)

Answers (1)

Answers (1)

reggie_guan
Explorer
0 Kudos

I came the same issue. I use JQuery's extend instead.

1. Define a xx.js like a util:

jQuery.sap.declare("xx.xx.xx");

xx.xx.xx = {

''''

};

2. in the view file:

jQuery.sap.require("xx.xx.xx");

........

createContent : function(ctl) {

jQuery.extend(true, this, xx.xx.xx);

.....}

kedarT
Active Contributor
0 Kudos

Hi,

Hope this helps - SAPUI5 SDK - Demo Kit