From d2d8870f06b9e29aa7adfddb252ab102af7fba93 Mon Sep 17 00:00:00 2001 From: Alex Gyoshev Date: Wed, 6 Aug 2014 11:30:23 +0300 Subject: [PATCH] Select root-level non-expandable nodes --- _assets/javascripts/app.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/_assets/javascripts/app.js b/_assets/javascripts/app.js index 803282ad..71a85060 100644 --- a/_assets/javascripts/app.js +++ b/_assets/javascripts/app.js @@ -3,17 +3,21 @@ function expandNavigation(url) { var segments = url.split("/"); var page = segments[segments.length - 1]; - this.expandPath(segments, function() { - var dataSource = this.dataSource; - var node; + if (segments.length > 1) { + this.expandPath(segments, function() { + var dataSource = this.dataSource; + var node; - for (var idx = 0; idx < segments.length; idx++) { - node = dataSource.get(segments[idx]); - dataSource = node.children; - } + for (var idx = 0; idx < segments.length; idx++) { + node = dataSource.get(segments[idx]); + dataSource = node.children; + } - node.set("selected", true); - }); + node.set("selected", true); + }); + } else { + this.dataSource.get(page).set("selected", true); + } this.unbind("dataBound", arguments.callee); }