brianmwadime
12/12/2015 - 10:58 AM

X-Editable using PATCH update

X-Editable using PATCH update

var makeEditable = function() {
  $('#' + cell01id).editable({
      url: 'https://example.com/values/' + uniqueID + '.json',
      type: 'date',
      pk: uniqueID,
      title: 'Update Info:',
      ajaxOptions: {
        contentType: 'application/json',
        type: 'patch',
        dataType: 'json'
      },
      params: function(params) { 
        var obj = { "date": params.value };
        return JSON.stringify(obj)
      },
      success: function(response, newValue) {
        if (response.status == 'error') {
          return response.msg; //msg will be shown in editable form
        }
      }
  });