Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82109

How to Override Editor Remove to Act Exactly Like Editor Edit

$
0
0
Great idea that the DataTable's editor sends an array of IDs to the web service to delete when data.action === 'remove'. Unfortunately we have already established our web services to act exactly like the editor edit function (ie: sending a JSON payload of data). So how can I override the editor remove process to act exactly like edit below?

} else if (data.action === 'edit') {
                        $.ajax({
                            "type": method,
                            "contentType": "application/json; charset=utf-8",
                            "url": url,
                            "data": JSON.stringify({
                                CT2_ID: data.data.CT2_ID.toString(),
                                NAME: data.data.NAME.toString(),
                                DESCRIPTION: data.data.DESCRIPTION.toString(),
                                DATA_VALUE: data.data.DATA_VALUE.toString(),
                                UPDATED_BY: data.data.UPDATED_BY.toString()
                            }),
                            "dataType": "json",
                            "headers": {
                                "APIAuthorization": "AuthID",
                                "APIEnvironment": "DEV",
                                "APIVersion": "1.00"
                            },
                            "success": function (json) {
                                successCallback(json);
                            },
                            "error": function (xhr, error, thrown) {
                                errorCallback(xhr, error, thrown);
                            }
                        }); 

I tried using
editor.on('onPreSubmit', function (e, data) {
                if (data.action === 'remove') {
                alert(JSON.stringify(data));
                }
});
but data is empty.

This is our only open item left with the editor.

Viewing all articles
Browse latest Browse all 82109

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>