[open-ils-commits] r11933 - trunk/Open-ILS/web/js/dojo/openils/widget
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jan 23 10:56:36 EST 2009
Author: erickson
Date: 2009-01-23 10:56:34 -0500 (Fri, 23 Jan 2009)
New Revision: 11933
Modified:
trunk/Open-ILS/web/js/dojo/openils/widget/FilteringTreeSelect.js
Log:
don't forget the forests
Modified: trunk/Open-ILS/web/js/dojo/openils/widget/FilteringTreeSelect.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/FilteringTreeSelect.js 2009-01-23 15:37:41 UTC (rev 11932)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/FilteringTreeSelect.js 2009-01-23 15:56:34 UTC (rev 11933)
@@ -25,6 +25,7 @@
labelAttr : 'name',
childField : 'children',
tree : null,
+ dataList : [],
startup : function() {
this.tree = (typeof this.tree == 'string') ?
@@ -33,19 +34,19 @@
console.log("openils.widget.FilteringTreeSelect: Tree needed!");
return;
}
- var list = this._makeNodeList(this.tree);
+ if(!dojo.isArray(this.tree)) this.tree = [this.tree];
+ var self = this;
+ this.tree.forEach(function(node) { self._makeNodeList(node); });
this.store = new dojo.data.ItemFileReadStore(
- {data:fieldmapper[list[0].classname].toStoreData(list)});
+ {data:fieldmapper[this.dataList[0].classname].toStoreData(this.dataList)});
this.inherited(arguments);
},
// Compile the tree down to a dept-first list of nodes
- _makeNodeList : function(node, list) {
- if(!list) list = [];
- list.push(node);
+ _makeNodeList : function(node) {
+ this.dataList.push(node);
for(var i in node[this.childField]())
- this._makeNodeList(node[this.childField]()[i], list);
- return list;
+ this._makeNodeList(node[this.childField]()[i]);
},
// For each item, find the depth at display time by searching up the tree.
More information about the open-ils-commits
mailing list