AnsweredAssumed Answered

FATAL sidecar. Changing views create-actions.js

Question asked by Gerardo Garcia Lima on Aug 19, 2015
Hi everyone,

So, i finally got it to work

({   extendsFrom: 'CreateActionsView',   initialize: function(options){        this._super('initialize',[options]);    this.model.on('change:persona', this.changeView, this);   },   changeView: function(model, options) {    var persona = this.model.get('persona');          if(persona === 'moral'){           this.meta = app.metadata.getView(this.module, 'recordMoral');           this._super('render',[options]);          }else{           this.meta = app.metadata.getView(this.module, 'create-actions');           this._super('render',[options]);          }   }  })

create-actions.js loads a view that has a field called "persona", when it changes its value will load a new meta in which does not exist some fields but the "persona" field still existing. So now i can go back to the other view and vice versa.

The problem here is that i get this error on the console of Chrome.

  1. FATAL[2015-8-19 20:0:28]: Uncaught TypeError: Cannot call method 'find' of null at http://localhost/Sugar/sidecar/minified/sidecar.min.js?v=iADYa2T3IR7hBthjBoxYqw on line 12649 sidecar.min.js:17135
  1. Uncaught TypeError: Cannot call method 'find' of null
each time i change the view. But not on the first time. I can even set this.meta on the initialize function and works well for any of the view I choose. The problem is updating the meta and then rendering.

Outcomes