Skip to content
This repository was archived by the owner on Dec 16, 2020. It is now read-only.

gravplats/marionette.groupedcollectionview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Marionette.GroupedCollectionView

Group and display models by a given key.

Usage

  var ItemView = Marionette.ItemView.extend({
    template: '#item-view-template'
  });

  var GroupedItemView = Marionette.CompositeView.extend({
    template: '#grouped-item-view-template',

    itemView: ItemView,

    itemViewContainer: '[data-collection-view]'
  });

  var GroupedCollectionView = Marionette.GroupedCollectionView.extend({
    itemView: GroupedItemView,

    groupByKey: 'date'
  });

  var data = [
    { date: '2014-01-01', text: 'A' },
    { date: '2014-01-01', text: 'B' },
    { date: '2014-01-02', text: 'C' },
    { date: '2014-01-03', text: 'D' }
  ];

  var collection = new Backbone.Collection(data);
  var view = new GroupedCollectionView({ collection: collection });

License

Licensed under MIT. Please refer to LICENSE for more information.

About

[unmaintained] A view that groups and displays models by a given key

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published