makeeditable / jeditable: How can I use my own function for sAddURL and sDeleteURL

makeeditable / jeditable: How can I use my own function for sAddURL and sDeleteURL

mbitmbit Posts: 1Questions: 0Answers: 0
edited December 2011 in Plug-ins
Hello,

I would like to use my own function for sDeleteURL instead of an URL.
I know it`s possible for updating a cell with sUpdateURL like this (see http://jquery-datatables-editable.googlecode.com/svn/trunk/custom-editors.html):

sUpdateURL: function(value, settings){
alert("Custom function for posting results");
return value;
}

but i haven`t found a way for adding and deleting a row.

Thank you!

Replies

  • andreacobaandreacoba Posts: 6Questions: 0Answers: 0
    Can anyone help with this question? I am having the same problem. I tried this but it throws an error: 405 (method not allowed).

    sAddURL: function (value, settings) {
    return value;
    }
  • dhocheedhochee Posts: 1Questions: 0Answers: 0
    edited January 2012
    sUpdateUrl supports a function because jquery.jeditable.js checks in the form submit if the target is a function. However, the editable grid (jquery.dataTables.editable.js) was designed around the assumption that you are interacting via ajax calls to a server as data is modified, and thus does not check to see if the url's are functions.

    In jquery.dataTables.editable.js, you will likely find that it isn't too difficult to modify the functions _fnOnRowAdding() and _fnDeleteRow() to check if sDeleteURL and sAddURL are actually functions and then call them rather than calling $.ajax(). I'm going to do something similar myself so I can support batch updates from a dialog box, in which case I don't want the changes to be sent to the server until the user clicks ok.
  • andreacobaandreacoba Posts: 6Questions: 0Answers: 0
    Thanks I'll try it out.
This discussion has been closed.