How to create multi-row in dataTable Editor

How to create multi-row in dataTable Editor

Anthonia JeromeAnthonia Jerome Posts: 12Questions: 6Answers: 0
edited September 2020 in Free community support

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

var editor; // use a global for the submit and return data rendering in the examples
 
$(document).ready(function() {
    editor = new $.fn.dataTable.Editor( {
        ajax: "master/person",
        table: "#example",
        fields: [ {
                label: "First name:",
                name: "first_name"
            }, {
                label: "Middle name:",
                name: "middle_name"
            },{
                label: "Last name:",
                name: "last_name"
            }
        ]
    } );``

    var table = $('#example').DataTable( {
        lengthChange: false,
        ajax: "master/person",
        columns: [
            { data: "first_name" },
            { data: "middle_name" },
            { data: "last_name" }
        ],
        select: true
    } );
 
    // Display the buttons
    new $.fn.dataTable.Buttons( table, [
        { extend: "create", editor: editor },
        { extend: "edit",   editor: editor },
        { extend: "remove", editor: editor }
    ] );
 
    table.buttons().container()
        .appendTo( $('.col-md-6:eq(0)', table.table().container() ) );
} );

Hi,
I have the code like the ones above, I want to create multi-row so that when submitted to the database I insert more than one row in the database table. The goal is, am designing an application in which all the names of a person a very important so the process should be like this: When the names are submitted they are inserted in one column in a database table, and then the numbers 1, 2, 3 ... are inserted on the adjacent column to show if the name is the first second or third, and I want it to accommodate even more than three names. So in short how can I archive this please using Editor multi-row create API?

NB: Sorry for failure to put my code smart at the forum here

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.