Skip to content

Marionette layout that allows to define subviews inside regions in a declarative manner.

License

Notifications You must be signed in to change notification settings

filippomangione/marionette.compositelayout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

marionette.compositelayout

Marionette layout that allows to define subviews inside regions in a declarative manner.

Basic Use

It extends from Marionette.LayoutView to provide a simple way to attach subviews to a layout's regions. Each subview is instanciated and rendered by calling initializeComponents method. Options and events can be passed to each component.

var DashboardLayout = Marionette.CompositeLayout.extend({
  template: dashboardTpl,
  
  regions: {
    chart: '[data-chart]'
  },
  
  onCustomEvent: function() {
    /* ... */
  },
  
  components: {
    chart: {
      view: ChartView,
      region: 'chart',
      events: {
        'custom.event': 'onCustomEvent'
      },
      options: function () {
        return {
          foo: 'bar'
        };
      }
    }
  },
    
  onRender: function() {
   this.initializeComponents();
  }
  
});

var dashboard = new DashboardLayout();

License

Copyright 2015, Filippo Mangione (@PhilMangione).
marionette.compositelayout.js may be freely distributed under the MIT license.

About

Marionette layout that allows to define subviews inside regions in a declarative manner.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published