From 19563f90d0c91af869327a93ebe4a5cc206eeca7 Mon Sep 17 00:00:00 2001 From: Ben Girardeau Date: Wed, 7 Jun 2017 10:00:03 -0500 Subject: [PATCH] Added unselectAll function. --- src/js/bootstrap-treeview.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/js/bootstrap-treeview.js b/src/js/bootstrap-treeview.js index 7a82a2eeb..8fc2b7e7a 100644 --- a/src/js/bootstrap-treeview.js +++ b/src/js/bootstrap-treeview.js @@ -117,7 +117,8 @@ selectNode: $.proxy(this.selectNode, this), unselectNode: $.proxy(this.unselectNode, this), toggleNodeSelected: $.proxy(this.toggleNodeSelected, this), - + unselectAll: $.proxy(this.unselectAll, this), + // Expand / collapse methods collapseAll: $.proxy(this.collapseAll, this), collapseNode: $.proxy(this.collapseNode, this), @@ -835,6 +836,18 @@ this.render(); }; + /** + Unselect all tree nodes + @param {optional Object} options + */ + Tree.prototype.unselectAll = function (options) { + var identifiers = this.findNodes('true', 'g', 'state.selected'); + this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) { + this.setSelectedState(node, false, options); + }, this)); + + this.render(); + }; /** Collapse all tree nodes