Skip to content

Commit 17214a7

Browse files
authored
fix empty dataset throws an error on start (#313)
- dataset often comes from backend and is delayed, data length doesn't always exist
1 parent fa7da1a commit 17214a7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

slick.grid.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,7 +1799,7 @@ if (typeof Slick === "undefined") {
17991799
hasFrozenRows = true;
18001800
frozenRowsHeight = ( options.frozenRow ) * options.rowHeight;
18011801

1802-
var dataLength = getDataLength() || this.data.length;
1802+
var dataLength = getDataLength();
18031803

18041804
actualFrozenRow = ( options.frozenBottom )
18051805
? ( dataLength - options.frozenRow )
@@ -2380,7 +2380,7 @@ if (typeof Slick === "undefined") {
23802380
if (data.getLength) {
23812381
return data.getLength();
23822382
} else {
2383-
return data.length;
2383+
return data && data.length || 0;
23842384
}
23852385
}
23862386

0 commit comments

Comments
 (0)