From 0a51c9b280130b7c1c67679c020a2cbabc7f8761 Mon Sep 17 00:00:00 2001 From: Punit Gupta Date: Sun, 11 Jun 2017 03:46:52 +0530 Subject: [PATCH 1/2] Stringify instead of dirty concatenation --- public/index.html | 66 +++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/public/index.html b/public/index.html index 6f23ccd23..7c7c3f2fc 100644 --- a/public/index.html +++ b/public/index.html @@ -416,39 +416,39 @@

} ]; - var json = '[' + - '{' + - '"text": "Parent 1",' + - '"nodes": [' + - '{' + - '"text": "Child 1",' + - '"nodes": [' + - '{' + - '"text": "Grandchild 1"' + - '},' + - '{' + - '"text": "Grandchild 2"' + - '}' + - ']' + - '},' + - '{' + - '"text": "Child 2"' + - '}' + - ']' + - '},' + - '{' + - '"text": "Parent 2"' + - '},' + - '{' + - '"text": "Parent 3"' + - '},' + - '{' + - '"text": "Parent 4"' + - '},' + - '{' + - '"text": "Parent 5"' + - '}' + - ']'; + var json = JSON.stringify([ + { + "text": "Parent 1", + "nodes": [ + { + "text": "Child 1" + "nodes": [ + { + "text": "Grandchild 1" + }, + { + '"text": "Grandchild 2" + } + ] + }, + { + "text": "Child 2" + } + ] + }, + { + "text": "Parent 2" + }, + { + "text": "Parent 3" + }, + { + "text": "Parent 4" + }, + { + "text": "Parent 5" + } + ]); $('#treeview1').treeview({ From 741e6d614a8b601808cfc9b61d8ec8313aff3983 Mon Sep 17 00:00:00 2001 From: Punit Gupta Date: Sun, 11 Jun 2017 03:47:44 +0530 Subject: [PATCH 2/2] Minor fix --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 7c7c3f2fc..089eb3686 100644 --- a/public/index.html +++ b/public/index.html @@ -427,7 +427,7 @@

"text": "Grandchild 1" }, { - '"text": "Grandchild 2" + "text": "Grandchild 2" } ] },