Announcement

Collapse
No announcement yet.

How to call original function of customized view?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to call original function of customized view?

    for example how do i invoke the original setup() in my own setup() ?

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

    Comment


    • tothewine
      tothewine commented
      Editing a comment
      Thanks, I totally skipped that part!

  • #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


    • #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({ 

      Comment

      Working...
      X