How to call original function of customized view?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tothewine
    Active Community Member
    • Jan 2018
    • 373

    How to call original function of customized view?

    for example how do i invoke the original setup() in my own setup() ?
  • item
    Active Community Member
    • Mar 2017
    • 1476

    #2
    Hi,

    if understand your question, a sample I use.. you must inherit :
    else all is explain here : https://github.com/espocrm/documenta...ustom-views.md


    PHP Code:
    Espo.define('custom:views/meeting/detail', 'crm:views/meeting/detail', function (Dep) {
    
    return Dep.extend({
        setup: function () {
            Dep.prototype.setup.call(this); 
    
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment


    • tothewine
      tothewine commented
      Editing a comment
      Thanks, I totally skipped that part!
  • tothewine
    Active Community Member
    • Jan 2018
    • 373

    #3
    So my current code now is this. I had some trouble with extending the events property, because it would delete all other events if I defined only my own, so I used delegateEvents. Is there a better way like the __APPEND__ used for metadata customizations?

    PHP Code:
    Espo.define('custom:views/lead/fields/phone', 'views/fields/phone', function (Dep) { return Dep.extend({
            setup: function () {
               this.events['click selector'] = function (e) { /* ... code ... */ }.bind(this);
               this.delegateEvents(); // reload events. is this the best way?
               Dep.prototype.setup.call(this); // call original setup
            }
     });}); 
    
    Last edited by tothewine; 01-29-2019, 10:19 AM.

    Comment

    • item
      Active Community Member
      • Mar 2017
      • 1476

      #4
      Sorry,
      never make a custom view for field type. if you can share code, maybe i will try.
      but you can add more inherit like this :

      PHP Code:
      Espo.define('custom:views/lead/fields/phone', ['views/fields/phone', 'view/....' ], function (Dep) { return Dep.extend({ 
      
      If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

      Comment

      Working...