0.9.6 • Published 6 years ago

@codetasty/collection-cluster v0.9.6

Weekly downloads
1
License
GPLv3
Repository
github
Last release
6 years ago

Collection Cluster

Collection Cluster on NPM

Vanilla JS library for displaying large data sets easily with great performance.

Install

$ npm install @codetasty/collection-cluster --save

Usage

<ul class="list"></ul>
var data = ['Item 1', 'Item 2', 'Item 3'];

var collection = new CollectionCluster.Collection(document.querySelector('.list'), {
	size: {
		height: 30,
	},
	getLength: function() {
		return data.length;
	},
	cellForIndex: function(collection, index) {
		let cell = collection.dequeueReusableCell('custom');
		cell.el.textContent = data[index];
		
		return cell;
	}
});

this.collection.registerCell('custom', CollectionCluster.Cell);

this.collection.hook();