Can get Editor to edit only changed values

Can get Editor to edit only changed values

bjshortybjshorty Posts: 20Questions: 6Answers: 0

I've been trying to have my edit form submit only the changed values because my password field is updated every time I change any field on the form.

I tried adding the formOptions code, but my password keeps being submitted every time a field is edited.

formOptions: {
        main: {
            submit: 'changed'
        }
}

I also tried adding the on Click function, but I need it to be on Edit.

$('#myTable').on( 'click', 'tbody tr', function () {
    editor.edit( this, {
        submit: 'changed'
    } );
} );

How can I submit only the edited fields?

This is my code:

var table = $('#example').DataTable({
                        responsive: true,
                        dom: "Bfrtip",
                        ajax: "Server-script/contacts.php",
                        columns: [
                            { // Responsive control column
                                data: null,
                                defaultContent: '',
                                className: 'control',
                                orderable: false
            }, {
                                data: "id"
                                        },
                            {
                                data: null,
                                render: function (data, type, row) {
                                    // Combine the first and last names into a single table field
                                    return data.first_name + ' ' + data.last_name;
                                }
                    },
                            {
                                data: "office"
                                        },
                            {
                                data: null,
                                render: function (data, type, row) {
                                    return '<a href="mailto:' + data.email + '?Subject=Saludos!">' + data.email + '</a>';
                                }
                                        },
                            {
                                data: null,
                                render: function (data, type, row) {
                                    return '<a href="tel:' + data.work + '">' + data.work + '</a>';
                                }
                                        },
                            {
                                data: "extension"
                            },
                            {
                                data: "tittle"
                            },
                            {
                                data: null,
                                render: function (data, type, row) {
                                    return '<a href="tel:' + data.phone + '">' + data.phone + '</a>';
                                }
                            },
                            {
                                data: null,
                                render: function (data, type, row) {
                                    return '<a href="tel:' + data.home + '">' + data.home + '</a>';
                                }
                            },
                            {
                                data: null,
                                render: function (data, type, row) {
                                    return '<a href="mailto:' + data.email2 + '?Subject=Saludos!">' + data.email2 + '</a>';
                                }
                            }
                       ], 
                       order: [2, 'asc'],
                        select: true,
                        buttons: [

                            {
                                extend: "create",
                                editor: editor
                                        },
                            {
                                extend: "edit",
                                editor: editor

                                        },
                            {
                                extend: "remove",
                                editor: editor
                                        },
                            {

                                extend: 'collection',
                                text: 'Export',
                                buttons: [
                    'excel',
                    'print'
                ]
            }

        ],
                        formOptions: {
                            main: {
                                submit: 'changed'
                            }
                        }

                    });

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.