Need to add customization to a common view, which is extended by every other view

Team,

I want to know a common view file where i could add my conditional customization,  so that i can apply my changes to multiple files.

Digging into the code  it seems like clients/base/views/base/base.js can be that file which could serve my requirement. but somehow BaseView is not getting overridden into the custom folder i.e. custom/clients/base/views/base/base.js with the below code snippet.

/**
* @class View.Views.Base.BaseCustomView
* @alias SUGAR.App.view.views.BaseCustomBaseView
* @extends View.BaseView
*/
({
extendsFrom: "BaseView",
initialize: function() {
console.log("Fdsfsdfds");
this._super('initialize', [options]);
},

})

Need help as soon as I can get.

  • Dear Amber

    Overriding is essentially creating or copying a view to be used by your application that is not extending its parent.

    Please check the next doc here

    Kind regards

  • -  Thanks for reply, but what i am trying to do is extend BaseView to CustomBaseView. 

    But with whatever i did, it just doesn't trigger the initialize method in my CustomBaseView which normally does happen for the Record View which you have shared.

    Basically i want to extend the Parent BaseView in clients/base/views/base/base.js

  • Your approach will not work because all views which extends BaseView explicit inherit from it:

    Fullscreen
    1
    extendsFrom: "BaseView",
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Your approach will work for custom views which, eventually, extends your custom one:

    Fullscreen
    1
    extendsFrom: "CustomBaseView",
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • I agree with andré on the point that custom views would have to inherit from the custombaseview

  • @Andre Lopes - I want to extend functionality of BaseView itself because most of the views inherit BaseView. My requirement is not to create any new custom view. The BaseView itself should add my customization everytime it gets called. 

    When i write my customization in the core file itself, it works as expected, but to make it upgrade safe, i am trying to move it to custom folder so that every time parent BaseView is called, it should also include my customization. 

  • As I previously explained and Sanchez agreeded, it is not possible to accomplish such a feature without creating custom views for all cascading views.

    André Lopes
    Lampada Global
    Skype: andre.lampada