Skip to Content
avatar image
Former Member

Extending JSView

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Feb 10, 2015 at 02:36 AM

    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);

    .....}

    Add comment
    10|10000 characters needed characters exceeded