Change editor option "table" before open editor modal

Change editor option "table" before open editor modal

merlauzmerlauz Posts: 2Questions: 1Answers: 0
edited January 2020 in Free community support

Hello everyone, can I dynamically change the name of the editor's table option, for example "#example" to "#example" + index after click editor button, before opening the modal?

var editor;
 
$(document).ready(function() {
    editor = new $.fn.dataTable.Editor( {
        ajax: "......",
       table: "#example",
        fields: [ {
                label: "First name:",
                name: "first_name"
           ......
        ]
    } );
 
    $('#example').DataTable( {
        dom: "Bfrtip",
        ajax: "../php/staff.php",
        columns: [
            ........
        ],
        select: true,
        buttons: [
           ** { extend: "edit",   editor: editor }**
        ]
    } );
} );

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

Answers

  • merlauzmerlauz Posts: 2Questions: 1Answers: 0

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    You can't change it, but you can create another Editor instance using the new name.

    Colin

This discussion has been closed.