Wrap initialization code in dojo.addOnLoad() to eliminate timing
authordjfiander <djfiander@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 14 May 2008 02:47:07 +0000 (02:47 +0000)
committerdjfiander <djfiander@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 14 May 2008 02:47:07 +0000 (02:47 +0000)
bugs with authentication.

git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9597 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 6ea9755..1713346 100644 (file)
@@ -4,6 +4,9 @@ if(!dojo._hasResource["openils.widget.FundSelector"]){
 
     dojo.require("dojox.grid.editors");
 
+    dojo.require('fieldmapper.Fieldmapper');
+    dojo.require('fieldmapper.dojoData');
+
     /**
      * This widget provides a specific selector for selecting
      * a fund.
@@ -12,10 +15,6 @@ if(!dojo._hasResource["openils.widget.FundSelector"]){
     dojo.declare("openils.widget.FundSelector", dojox.grid.editors.Select, {
 
        constructor: function(inCell) {
-           console.dir(this);
-           this.store = this.store || this.cell.store;
-           this.identifier = this.identifier || this.cell.identifier || "id";
-           this.name = this.name || this.cell.name || "name";
            this.options = openils.widget.FundSelector.fundNames;
            this.values = openils.widget.FundSelector.fundCodes;
        }
@@ -24,20 +23,23 @@ if(!dojo._hasResource["openils.widget.FundSelector"]){
     openils.widget.FundSelector.fundNames = [];
     openils.widget.FundSelector.fundCodes = [];
 
-    fieldmapper.standardRequest(
-       ['open-ils.acq', 'open-ils.acq.fund.org.retrieve'],
-       {
-           async: true,
-           params: [openils.User.authtoken, null, {flesh_summary:1}],
-           oncomplete: function (r) {
-               var msg;
-               
-               while (msg = r.recv()) {
-                   var f = msg.content();
-                   openils.widget.FundSelector.fundNames.push(f.name());
-                   openils.widget.FundSelector.fundCodes.push(f.id());
-               }
-           }
-       }
-    );
+    dojo.addOnLoad(
+       function() {
+           fieldmapper.standardRequest(
+               ['open-ils.acq', 'open-ils.acq.fund.org.retrieve'],
+               {
+                   async: true,
+                   params: [openils.User.authtoken, null, {flesh_summary:1}],
+                   oncomplete: function (r) {
+                       var msg;
+                       
+                       while (msg = r.recv()) {
+                           var f = msg.content();
+                           console.dir(f)
+                           openils.widget.FundSelector.fundNames.push(f.name());
+                           openils.widget.FundSelector.fundCodes.push(f.id());
+                       }
+                   }
+               });
+       });
 }