afterRender Function not calling this.model.get()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • VinhPN
    Junior Member
    • Jan 2019
    • 26

    afterRender Function not calling this.model.get()

    Hi,,

    I have a simple function in my record/detail view

    Code:
        afterRender: function(){
            console.log('afterRender');
            if(this.model.get('approved')){
                console.log('This record is approved');
            }
    },
    When the detail view is rendered, then 'afterRender' is logged in the console. The problem is, if I view a record from a different entity, then view the record of this entity again, the message 'This record is approved' is not logged, even when the boolean is true in the record. I have to refresh the view in order for the if statement to go through. Is there any way to have the if statement work first time around?
Working...