From 817c98ec3b11fefeb055611592de7c898751e087 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Fri, 07 Mar 2014 10:10:47 -0500
Subject: [PATCH] Add method to reset a treelist widget

---
 program/js/treelist.js |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/program/js/treelist.js b/program/js/treelist.js
index d940e39..d56e7b8 100644
--- a/program/js/treelist.js
+++ b/program/js/treelist.js
@@ -56,6 +56,7 @@
   this.collapse = collapse;
   this.select = select;
   this.render = render;
+  this.reset = reset;
   this.drag_start = drag_start;
   this.drag_end = drag_end;
   this.intersects = intersects;
@@ -314,6 +315,20 @@
   }
 
   /**
+   *
+   */
+  function reset()
+  {
+    select('');
+
+    data = [];
+    indexbyid = {};
+    drag_active = false;
+
+    container.html('');
+  }
+
+  /**
    * Render the tree list from the internal data structure
    */
   function render()

--
Gitblit v1.9.1