allow the caller to provide a reference to the tree. use toStoreItem instead of...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 9 Jan 2009 15:16:21 +0000 (15:16 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 9 Jan 2009 15:16:21 +0000 (15:16 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@11783 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/widget/FilteringTreeSelect.js

index 6baf42e..76c8645 100644 (file)
@@ -30,7 +30,8 @@ if(!dojo._hasResource["openils.widget.FilteringTreeSelect"]){
                 this.labelAttr = '_label'; // force it
                 this.labelType = 'html'; // force it
 
-                this._tree = dojox.jsonPath.query(window, '$.' + this.tree, {evalType:"RESULT"});
+                this._tree = (typeof this.tree == 'string') ? 
+                        dojox.jsonPath.query(window, '$.' + this.tree, {evalType:"RESULT"}) : this.tree;
                 if (!dojo.isArray(this._tree)) this._tree = [ this._tree ];
 
                 this._datalist = [];
@@ -52,7 +53,7 @@ if(!dojo._hasResource["openils.widget.FilteringTreeSelect"]){
             _add_items : function ( node, depth ) {
                 var lpad = this.defaultPad * depth++;
 
-                var data = node.toStoreData();
+                var data = node.toStoreItem();
                 data._label = '<div style="padding-left:'+lpad+'px;">' + node[this.searchAttr]() + '</div>';
 
                 this._datalist.push( data );