Skip to content
Permalink
Browse files

Handle hidden lists. Closes #100

  • Loading branch information...
NeXTs committed Mar 5, 2017
1 parent 973efb7 commit 569c02927b7215c1ea272a44dfd0fd2690880978
Showing with 18 additions and 20 deletions.
  1. +6 −8 clusterize.js
  2. +11 −11 clusterize.min.js
  3. +1 −1 package.json
@@ -1,4 +1,4 @@
/*! Clusterize.js - v0.17.5 - 2017-02-25
/*! Clusterize.js - v0.17.6 - 2017-03-05
* http://NeXTs.github.com/Clusterize.js/
* Copyright (c) 2015 Denis Lukov; Licensed GPLv3 */

@@ -63,7 +63,7 @@
var rows = isArray(data.rows)
? data.rows
: self.fetchMarkup(),
cache = {data: '', top: 0, bottom: 0},
cache = {},
scroll_top = self.scroll_elem.scrollTop;

// append initial data
@@ -161,24 +161,22 @@
return rows;
},
// get tag name, content tag name, tag height, calc cluster height
exploreEnvironment: function(rows) {
exploreEnvironment: function(rows, cache) {
var opts = this.options;
opts.content_tag = this.content_elem.tagName.toLowerCase();
if( ! rows.length) return;
if(ie && ie <= 9 && ! opts.tag) opts.tag = rows[0].match(/<([^>\s/]*)/)[1].toLowerCase();
if(this.content_elem.children.length <= 1) this.html(rows[0] + rows[0] + rows[0]);
if(this.content_elem.children.length <= 1) cache.data = this.html(rows[0] + rows[0] + rows[0]);
if( ! opts.tag) opts.tag = this.content_elem.children[0].tagName.toLowerCase();
this.getRowsHeight(rows);
},
getRowsHeight: function(rows) {
var opts = this.options,
prev_item_height = opts.item_height;
opts.cluster_height = 0
opts.cluster_height = 0;
if( ! rows.length) return;
var nodes = this.content_elem.children;
var node = nodes[Math.floor(nodes.length / 2)];
// don't measure height if element is hidden. fixes #98
if( ! node.offsetParent) return;
opts.item_height = node.offsetHeight;
// consider table's border-spacing
if(opts.tag == 'tr' && getStyle('borderCollapse', this.content_elem) != 'collapse')
@@ -257,7 +255,7 @@
insertToDOM: function(rows, cache) {
// explore row's height
if( ! this.options.cluster_height) {
this.exploreEnvironment(rows);
this.exploreEnvironment(rows, cache);
}
var data = this.generate(rows, this.getClusterNum()),
this_cluster_rows = data.rows.join(''),

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -1,6 +1,6 @@
{
"name": "clusterize.js",
"version": "0.17.5",
"version": "0.17.6",
"description": "Tiny vanilla JS plugin to display large data sets easily",
"main": "clusterize.js",
"style": "clusterize.css",

0 comments on commit 569c029

Please sign in to comment.
You can’t perform that action at this time.