shinobukawano / Ext.ux.AccordionList

Accordion List Component for Sencha Touch 2
http://kawanoshinobu.com/public/demo/accordionlist/
50 stars 28 forks source link

When in singleMode=true the nodes all collapse breaking a 2> tree navigatiton depth system. #8

Closed freedomson closed 11 years ago

freedomson commented 11 years ago

I did the following patch

diff --git a/ux/AccordionList.js b/ux/AccordionList.js
index 173f02e..9c3d9e2 100644
--- a/ux/AccordionList.js
+++ b/ux/AccordionList.js
@@ -345,6 +345,21 @@ Ext.define('Ext.ux.AccordionList', {
     },

     /**
+     * Collapse all of contents.
+     */
+    doSingleCollapse: function(record) {
+        var me = this;
+        me.doAll(function collapse(node) {
+            if(node.data.depth==record.data.depth)
+                node.collapse();
+            console.log(node);
+            /*if (!node.isLeaf()) {
+                node.childNodes.forEach(collapse, me);
+            }*/
+        });
+    },
+
+    /**
      * @private
      * @param  {Function} updater
      */
@@ -403,7 +418,7 @@ Ext.define('Ext.ux.AccordionList', {
             }
             else {
                 if(me.getSingleMode()) {
-                    me.doAllCollapse();
+                    me.doSingleCollapse(record);
                 }

                 node.expand();
shinobukawano commented 11 years ago

freedomson,

Sorry to my slow response, thank you for the patch. It's wonderful!

I've merged this patch for project. Good job ;)