model.get not always return value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Abanoub
    Junior Member
    • Sep 2016
    • 23

    model.get not always return value

    I have a custom side-panel view :

    Espo.define('custom:views/section/panel', 'views/record/panels/default-side', function (Dep) { return Dep.extend({ template: "custom:section/sub", setup: function () { Dep.prototype.setup.call(this); }, data: function () { var data = Dep.prototype.data.call(this); data.subSectionsArray = this.model.get("subSections"); return data; } }); });
    and in the controller :
    public function actionRead($params, $data, $request) { $res = parent::actionRead($params,$data,$request); $res['subSections'] = [["id"=> 1,"name"=> "test"]]; return $res; }
    now when I click on anytime in the list view it redirects me but I can't see my values , however if I refreshed it appears, so what am missing here since it only works on refresh , and sometimes after multiple clicks on the item from the list view?
  • yuri
    Member
    • Mar 2014
    • 8485

    #2
    You need to listen model change and call this.reRender(); method if your attribute is changed. When you navigate from list view it takes values from list view, renders detail view and then loads other data.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • Abanoub
      Junior Member
      • Sep 2016
      • 23

      #3
      Originally posted by yurikuzn
      You need to listen model change and call this.reRender(); method if your attribute is changed. When you navigate from list view it takes values from list view, renders detail view and then loads other data.
      thanks that worked!

      Comment

      Working...