list dump for trees
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 16 Feb 2006 09:05:02 +0000 (09:05 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 16 Feb 2006 09:05:02 +0000 (09:05 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3093 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/util/list.js

index 69c3273..cb6f2ed 100644 (file)
@@ -309,5 +309,26 @@ util.list.prototype = {
                }
                return list;
        },
+
+       'dump' : function(params) {
+               switch(this.node.nodeName) {
+                       case 'tree' : return this._dump_tree(params); break;
+                       default: throw('NYI: Need ._init() for ' + this.node.nodeName); break;
+               }
+       },
+
+       '_dump_tree' : function(params) {
+               var dump = [];
+               for (var i = 0; i < this.treechildren.childNodes.length; i++) {
+                       var row = [];
+                       var treeitem = this.treechildren.childNodes[i];
+                       var treerow = treeitem.firstChild;
+                       for (var j = 0; j < treerow.childNodes.length; j++) {
+                               row.push( treerow.childNodes[j].getAttribute('label') );
+                       }
+                       dump.push( row );
+               }
+               return dump;
+       }
 }
 dump('exiting util.list.js\n');