no need for a store if there is no tree data (don't attempt to access dataList[0])
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 12 Feb 2009 22:37:01 +0000 (22:37 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 12 Feb 2009 22:37:01 +0000 (22:37 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12167 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 3bbe94d..7adc651 100644 (file)
@@ -37,8 +37,10 @@ if(!dojo._hasResource["openils.widget.FilteringTreeSelect"]){
                 this.dataList = [];
                 var self = this;
                 dojo.forEach(this.tree, function(node) { self._makeNodeList(node); });
-                this.store = new dojo.data.ItemFileReadStore(
-                    {data:fieldmapper[this.dataList[0].classname].toStoreData(this.dataList)});
+                if(this.dataList.length > 0) {
+                    this.store = new dojo.data.ItemFileReadStore(
+                        {data:fieldmapper[this.dataList[0].classname].toStoreData(this.dataList)});
+                }
                 this.inherited(arguments);
             },