Monday 18 May 2015

javascript inheritance, frappe dialog email customization


frappe.views.CommunicationComposer =  frappe.views.CommunicationComposer.extend({
    make_fun: function(){
         show_alert('Hi');
    },
    make: function(){
        this._super();
        this.make_fun();
    }
})


http://ejohn.org/blog/simple-javascript-inheritance/


make is a convencion in frappe for the method that create the HTML widget


if you override the complete class by extending by the basic Class and not by CommunicationComposer the email_box cant show, because you destroyied the original class

Override example:
frappe.views.CommunicationComposer = Class.extend({
    my_fun : function() {
         show_alert('Hi');

    },

});


reference: http://ejohn.org/blog/simple-javascript-inheritance/

Thanks: @MaxMorais 

No comments:

Post a Comment