summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Leibman <michael.leibman@gmail.com>2013-04-21 11:33:24 -0700
committerMichael Leibman <michael.leibman@gmail.com>2013-04-21 11:33:35 -0700
commitdb6c10b5600b2bba15d6e0bee47c70b3a3d827bb (patch)
treec22cc0736c72661d6ba4a3fc99f1b0c1341c5d7b
parent9a1909d805759bfe7135d94f2f935578ff389174 (diff)
downloadSlickGrid-db6c10b5600b2bba15d6e0bee47c70b3a3d827bb.zip
SlickGrid-db6c10b5600b2bba15d6e0bee47c70b3a3d827bb.tar.gz
SlickGrid-db6c10b5600b2bba15d6e0bee47c70b3a3d827bb.tar.bz2
Merge branch 'fixex5' of https://github.com/oshea00/SlickGrid into oshea00-fixex5
-rw-r--r--examples/example5-collapsing.html17
1 files changed, 8 insertions, 9 deletions
diff --git a/examples/example5-collapsing.html b/examples/example5-collapsing.html
index 7c655ed..babbcd7 100644
--- a/examples/example5-collapsing.html
+++ b/examples/example5-collapsing.html
@@ -152,20 +152,19 @@ $(function () {
// prepare the data
for (var i = 0; i < 1000; i++) {
var d = (data[i] = {});
- var parent = null;
+ var parent;
- if (Math.random() > 0.8) {
+ if (Math.random() > 0.8 && i > 0) {
indent++;
- parent = i - 1;
- parents.push(parent);
+ parents.push(i - 1);
} else if (Math.random() < 0.3 && indent > 0) {
indent--;
- parent = parents.pop();
- } else if (parents.length > 0) {
+ parents.pop();
+ }
+
+ if (parents.length > 0) {
parent = parents[parents.length - 1];
- }
-
- if (indent == 0) {
+ } else {
parent = null;
}