ampersand-grouped-collection-view
Renders a collection of items that are clustered in groups, such as how chat messages can be displayed grouped by sender.
Part of the Ampersand.js toolkit for building clientside applications.
Install
npm install ampersand-grouped-collection-view
Example
var View = ;var GroupedCollectionView = ; var view = el: someDOMElement collection: messagesCollection itemView: View groupView: View { // Used to determine when a new group is needed. // Return `true` if `model` belongs to the same group // as `prevModel`. // The current group is also available for comparison. return modelsenderid === prevModelsenderid; } { // Prepare a Group model based on the Item model // that triggered the group's creation. // The previous group model is also provided. return modelsender; };