Announcement

Collapse
No announcement yet.

model.get not always return value

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

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

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

    Comment


    • #3
      Originally posted by yurikuzn View Post
      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...
      X