From 086c8023ad2255de75a02f06a29bf8d5c0b3be80 Mon Sep 17 00:00:00 2001 From: "M. Braun" Date: Thu, 26 Jan 2017 17:01:34 +0100 Subject: [PATCH] template becomes configurable, hide link if no href This enables the user to override the template, e.g. add _blank to link template. Additionally, the link is hidden if links are enabled but no have has been configured, e.g. when only some nodes need to be a link, --- src/js/bootstrap-treeview.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/bootstrap-treeview.js b/src/js/bootstrap-treeview.js index 7a82a2eeb..60393ed3a 100644 --- a/src/js/bootstrap-treeview.js +++ b/src/js/bootstrap-treeview.js @@ -41,6 +41,8 @@ checkedIcon: 'glyphicon glyphicon-check', uncheckedIcon: 'glyphicon glyphicon-unchecked', + template: {}, + color: undefined, // '#000000', backColor: undefined, // '#FFFFFF', borderColor: undefined, // '#dddddd', @@ -159,6 +161,7 @@ delete options.data; } this.options = $.extend({}, _default.settings, options); + this.template = $.extend(this.template, this.options.template); this.destroy(); this.subscribeEvents(); @@ -582,7 +585,7 @@ } // Add text - if (_this.options.enableLinks) { + if (_this.options.enableLinks && node.href) { // Add hyperlink treeItem .append($(_this.template.link)