Skip to content

Commit

Permalink
Fixed row's height determination for dynamically added rows. Default'…
Browse files Browse the repository at this point in the history
…s cleanup. Fixes #83
  • Loading branch information
NeXTs committed Sep 15, 2016
1 parent 6a16567 commit 8838614
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 28 deletions.
20 changes: 6 additions & 14 deletions clusterize.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Clusterize.js - v0.17.0 - 2016-09-12
/*! Clusterize.js - v0.17.1 - 2016-09-15
* http://NeXTs.github.com/Clusterize.js/
* Copyright (c) 2015 Denis Lukov; Licensed GPLv3 */

Expand Down Expand Up @@ -27,20 +27,14 @@
var self = this;

var defaults = {
item_height: 0,
block_height: 0,
rows_in_block: 50,
rows_in_cluster: 0,
cluster_height: 0,
blocks_in_cluster: 4,
tag: null,
content_tag: null,
show_no_data_row: true,
no_data_class: 'clusterize-no-data',
no_data_text: 'No data',
keep_parity: true,
callbacks: {},
scroll_top: 0
callbacks: {}
}

// public parameters
Expand Down Expand Up @@ -72,9 +66,6 @@
cache = {data: '', bottom: 0},
scroll_top = self.scroll_elem.scrollTop;

// get row height
self.exploreEnvironment(rows);

// append initial data
self.insertToDOM(rows, cache);

Expand Down Expand Up @@ -234,9 +225,6 @@
rows: rows_len ? rows : this.generateEmptyRow()
}
}
if( ! opts.cluster_height) {
this.exploreEnvironment(rows);
}
var items_start = Math.max((opts.rows_in_cluster - opts.rows_in_block) * cluster_num, 0),
items_end = items_start + opts.rows_in_cluster,
top_offset = Math.max(items_start * opts.item_height, 0),
Expand Down Expand Up @@ -265,6 +253,10 @@
},
// if necessary verify data changed and insert to DOM
insertToDOM: function(rows, cache) {
// explore row's height
if( ! this.options.cluster_height) {
this.exploreEnvironment(rows);
}
var data = this.generate(rows, this.getClusterNum()),
this_cluster_rows = data.rows.join(''),
this_cluster_content_changed = this.checkChanges('data', this_cluster_rows, cache),
Expand Down
25 changes: 12 additions & 13 deletions clusterize.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clusterize.js",
"version": "0.17.0",
"version": "0.17.1",
"description": "Tiny vanilla JS plugin to display large data sets easily",
"main": "clusterize.js",
"style": "clusterize.css",
Expand Down

0 comments on commit 8838614

Please sign in to comment.