Skip to content

Commit

Permalink
Fix dimension.groupAll when there are no records.
Browse files Browse the repository at this point in the history
Previously, an error was thrown.

Fixes #122.
  • Loading branch information
jasondavies committed Aug 14, 2014
1 parent 6103b76 commit 01b7ec2
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 5 deletions.
10 changes: 8 additions & 2 deletions crossfilter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(function(exports){
crossfilter.version = "1.3.8";
crossfilter.version = "1.3.9";
function crossfilter_identity(d) {
return d;
}
Expand Down Expand Up @@ -898,7 +898,8 @@ function crossfilter() {
reduceInitial,
update = crossfilter_null,
reset = crossfilter_null,
resetNeeded = true;
resetNeeded = true,
groupAll = key === crossfilter_null;

if (arguments.length < 1) key = crossfilter_identity;

Expand Down Expand Up @@ -999,6 +1000,10 @@ function crossfilter() {
update = updateMany;
reset = resetMany;
} else {
if (!k && groupAll) {
k = 1;
groups = [{key: null, value: initial()}];
}
if (k === 1) {
update = updateOne;
reset = resetOne;
Expand Down Expand Up @@ -1058,6 +1063,7 @@ function crossfilter() {
: k === 1 ? (reset = resetOne, update = updateOne)
: reset = update = crossfilter_null;
} else if (k === 1) {
if (groupAll) return;
for (var i = 0; i < n; ++i) if (filters[i]) return;
groups = [], k = 0;
filterListeners[filterListeners.indexOf(update)] =
Expand Down
2 changes: 1 addition & 1 deletion crossfilter.min.js

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

Loading

0 comments on commit 01b7ec2

Please sign in to comment.