crmEditable code cleanup
authorColeman Watts <coleman@civicrm.org>
Fri, 2 Jan 2015 18:46:57 +0000 (13:46 -0500)
committerColeman Watts <coleman@civicrm.org>
Fri, 2 Jan 2015 21:38:51 +0000 (16:38 -0500)
js/jquery/jquery.crmeditable.js

index 201d893054b844aebd3da7eb558195b5e037ff64..79f8d745151c646fd34e8378afa442780bd5dbed 100644 (file)
               context: 'create'
             };
           $i.data('optionsHashKey', hash);
-          if (optionsCache[hash]) {
-            return formatOptions(optionsCache[hash]);
+          if (!optionsCache[hash]) {
+            $.ajax({
+              url: CRM.url('civicrm/ajax/rest'),
+              data: {entity: info.entity, action: 'getoptions', json: JSON.stringify(params)},
+              async: false, // jeditable lacks support for async options lookup
+              success: function(data) {optionsCache[hash] = data.values;}
+            });
           }
-          $.ajax({
-            url: CRM.url('civicrm/ajax/rest'),
-            data: {entity: info.entity, action: 'getoptions', json: JSON.stringify(params)},
-            async: false, // jeditable lacks support for async options lookup
-            success: function(data) {optionsCache[hash] = data.values;}
-          });
           return formatOptions(optionsCache[hash]);
 
         }