More explanations on github

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • worldmiros
    Senior Member
    • Dec 2015
    • 120

    More explanations on github

    Would appreciate it if they were some explanation to functions createView() and Espo.define() in js files, mainly the parameters on github. I understand the first parameter in Espo.define() is the name of the file itself, third parameter is the function, but not understanding the second parameter.
  • alasdaircr
    Active Community Member
    • Aug 2014
    • 525

    #2
    The second parameter in Espo.define() is the child view's name, which the view inherit properties and behaviours from

    Comment

    • yuri
      Member
      • Mar 2014
      • 8440

      #3
      Module system in EspoCRM is designed in AMD approach.

      createView creates child view. If you call it in setup method it will be rendered automatically when the parent view is rendered. If you call createView after parent view has been already rendered you will need to render it manually in the callback.

      PHP Code:
      afterRender: function () {
           this.createView('someKey', 'custom:views/some-view', {
               el: this.options.el + ' .some-container' // container selector,
               model: this.model // model passed to child view
           }, function (view) {
              view.render();
          });
      } 
      
      Last edited by yuri; 01-13-2016, 01:26 PM.
      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

      Working...