Question about customizing Editor ajax object
Question about customizing Editor ajax object
Hello, I currently am using Datatables Editor API through my company's license (just to say I'm a valid user, this is just my personal account).
Our current project controls database operations via REST API calls. I've been following this example here to integrate Datatables with our custom REST calls: https://editor.datatables.net/examples/advanced/REST.html
One thing I was looking to work around: instead of passing the data to an external php file as in this example, would it be possible to process the data and do a REST call via a JavaScript callback? How would you access the row data when doing the ajax calls for create/delete/edit?
Thanks for any help you can offer
Answers
Certainly - the
ajax
option can be given as a function which allows complete control over where the data is sent and what you do with it. Equally,create
,edit
andremove
options can be specified for theajax
option, each of which inherits the same list of options as the parent - i.e. you could useajax.create
as a function andajax.edit
as a string URL. Might be a little mad that last option - but it is possible :-)You might also be interested in this example which shows
ajax
being used as a function.Regards,
Allan