custom ajax call for 'create' , 'edit' and 'remove' in datatables editor.

custom ajax call for 'create' , 'edit' and 'remove' in datatables editor.

sarangnewalkarsarangnewalkar Posts: 3Questions: 1Answers: 0

On 3 August 2018 at 15:58, website@datatables.net wrote:
Name: Sarang Newalkar
Email:newalkar.sarang@gmail.com

how can i call java action ( ajax call ) for create, ( NEW ) , edit and remove, Below is my code. i have achieved getting data from Spring MVC controller but not i want to create, edit and remove at backend side and need to process this functionality on backend , currently its all doing on front end side. below is my code. please help.

$(document).ready(function() {
var editor = new $.fn.dataTable.Editor( {

                            "sAjaxSource" : "./ParmSource",
                            "table": "#parmlist",
                            "idSrc": "parmRow",
                            "fields": [
                                    {
                                            "label": "PARM Type:",
                                            "name": "parmtype"
                                    },
                                    {
                                            "label": "PARM Name:",
                                            "name": "parmName"
                                    },
                                    {
                                            "label": "PARM Value:",
                                            "name": "parmValue"
                                    }
                            ]
                    } );

                    var table = $('#parmlist').DataTable( {
                            "dom": 'Bfrtip',
                            "sAjaxSource" : "./ParmSource",
                            "bProcessing": true,
                            "columns": [
                                    {
                                            "data": "parmtype"
                                    },
                                    {
                                            "data": "parmName"
                                    },
                                    {
                                            "data": "parmValue"
                                    }
                            ],
                            "select": true,
                            "buttons": [
                                    { 
                                            extend: 'create', 
                                            editor: editor



                                             },
                                    { extend: 'edit',   editor: editor },
                                    { extend: 'remove', editor: editor }
                            ]
                    } );
            } );

Hi Sarang,

"sAjaxSource" : "./ParmSource",

This should be:

"ajax" : "./ParmSource",

There is no sAjaxSource option in Editor. That is a legacy DataTables option. The full list of options for Editor is available here:
https://editor.datatables.net/reference/option/

Regards,
Allan

Sarang Newalkar newalkar.sarang@gmail.com
1:12 PM (5 minutes ago)
to Allan
Dear Allan,

Thanks for suggesting, i will update and try to execute same in my Spring MVC app, however my question is , Will the same ajax action be used for 'create', 'edit' and 'remove' ?

how can i define custom ajax call for 'create' , 'edit' and 'remove' for back-end calls.

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.