Merge pull request #67 from dpradeep/merge-20140827
[civicrm-core.git] / js / jquery / jquery.crmeditable.js
index b581ec4adc641e58fe311aae56441cfeb7e28d4f..bb86b2f65a5e6deb7f5bf68349ede18d74a78d80 100644 (file)
       el = this[0],
       ret = {},
       $row = this.first().closest('.crm-entity');
-    ret.entity = $row.data('entity') || $row[0].id.split('-')[0];
-    ret.id = $row.data('id') || $row[0].id.split('-')[1];
+      ret.entity = $row.data('entity') || $row[0].id.split('-')[0];
+      ret.id = $row.data('id') || $row[0].id.split('-')[1];
+      ret.action = $row.data('action') || 'setvalue';
+
     if (!ret.entity || !ret.id) {
       return false;
     }
@@ -41,7 +43,7 @@
           field: info.field,
           value: checked ? 1 : 0
         };
-        CRM.api(info.entity, 'setvalue', params, {
+        CRM.api(info.entity, info.action, params, {
           context: this,
           error: function(data) {
             editableSettings.error.call(this, info.entity, info.field, checked, data);
         var
           info = $i.crmEditableEntity(),
           params = {},
-          action = $i.data('action') || 'setvalue';
+          action = $i.data('action') || info.action;
         if (!info.field) {
           return false;
         }