Custom added field in account view not always available in afterRender

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • devespo
    Junior Member
    • May 2017
    • 15

    Custom added field in account view not always available in afterRender

    I have come across a strange problem:

    In /client/custom/src/views/account/record/detail.js

    I have configured to log one of the model attributes to console like so:

    Code:
    afterRender: function () {
        Dep.prototype.afterRender.call(this);
    
        console.log(this.model.attributes.customfield);
        console.log(this.model.attributes.id);
    }
    It seems like id attribute is alway available but customfield is only appearing intermittently. For example, I will go in specific account that has that field, and it will not log the value to console (undefined) the first time I load the account detail page. Then if I navigate away and come back to it it's there. It's almost like custom added fields are not retrieved in model in time when render happens and only appear after it's been cached? Something like that.

    Any idea what is going on?
    Last edited by devespo; 11-01-2019, 03:03 PM.
Working...