Uncaught TypeError: c.editor is null

Uncaught TypeError: c.editor is null

AloneInTheDarkAloneInTheDark Posts: 30Questions: 7Answers: 0

Hi,
i try this example:

`
var table_user_edit = new $.fn.dataTable.Editor( {
ajax: "https://editor.datatables.net/examples/php/staff.php",
table: "#tbl-ordini-edit",
fields: [ {
label: "First name:",
name: "first_name"
}, {
label: "Last name:",
name: "last_name"
}, {
label: "Position:",
name: "position"
}, {
label: "Office:",
name: "office"
}, {
label: "Extension:",
name: "extn"
}, {
label: "Start date:",
name: "start_date",
type: "datetime"
}, {
label: "Salary:",
name: "salary"
}
]
} );

    $('#tbl-ordini-edit').DataTable( {
        dom: "Bfrtip",
        ajax: "https://editor.datatables.net/examples/php/staff.php",
        columns: [
            { 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: "position" },
            { data: "office" },
            { data: "extn" },
            { data: "start_date" },
            { data: "salary", render: $.fn.dataTable.render.number( ',', '.', 0, '$' ) }
        ],
        select: true,
        buttons: [
            { extend: "create", editor: editor },
            { extend: "edit",   editor: editor },
            { extend: "remove", editor: editor }
        ]
    } );

HTML CODE

Name Position Office Extn. Start date Salary
Name Position Office Extn. Start date Salary

`

IMPORT JS
datatables.min.js
dataTables.editor.min.js

Licence type
DataTables Editor - 1 developer

Description of problem
in javascript console i recive this: Uncaught TypeError: c.editor is null
text http://localhost:8088/agrariae-doc/wp-content/plugins/edoc-agraria/js/dataTables.editor.min.js?ver=1.0:147
m http://localhost:8088/agrariae-doc/wp-content/plugins/edoc-agraria/js/datatables.min.js?ver=1.10.4:422
_buildButton http://localhost:8088/agrariae-doc/wp-content/plugins/edoc-agraria/js/datatables.min.js?ver=1.10.4:423
_expandButton http://localhost:8088/agrariae-doc/wp-content/plugins/edoc-agraria/js/datatables.min.js?ver=1.10.4:421
add http://localhost:8088/agrariae-doc/wp-content/plugins/edoc-agraria/js/datatables.min.js?ver=1.10.4:416
_constructor http://localhost:8088/agrariae-doc/wp-content/plugins/edoc-agraria/js/datatables.min.js?ver=1.10.4:419
u http://localhost:8088/agrariae-doc/wp-content/plugins/edoc-agraria/js/datatables.min.js?ver=1.10.4:415
H http://localhost:8088/agrariae-doc/wp-content/plugins/edoc-agraria/js/datatables.min.js?ver=1.10.4:414
Hb http://localhost:8088/agrariae-doc/wp-content/plugins/edoc-agraria/js/datatables.min.js?ver=1.10.4:61
za http://localhost:8088/agrariae-doc/wp-content/plugins/edoc-agraria/js/datatables.min.js?ver=1.10.4:77
f http://localhost:8088/agrariae-doc/wp-content/plugins/edoc-agraria/js/datatables.min.js?ver=1.10.4:122
u http://localhost:8088/agrariae-doc/wp-content/plugins/edoc-agraria/js/datatables.min.js?ver=1.10.4:122
jQuery 2
u http://localhost:8088/agrariae-doc/wp-content/plugins/edoc-agraria/js/datatables.min.js?ver=1.10.4:112
DataTable http://localhost:8088/agrariae-doc/wp-content/plugins/edoc-agraria/js/datatables.min.js?ver=1.10.4:196
<anonymous> http://localhost:8088/agrariae-doc/wp-content/plugins/edoc-agraria/js/edoc-agraria-dt.js?ver=1.01:272
jQuery 13

Replies

  • AloneInTheDarkAloneInTheDark Posts: 30Questions: 7Answers: 0
    edited May 2021

    Hi
    i have found the solution. The error is here:

    buttons: [
    { extend: "create", editor: editor },
    { extend: "edit", editor: editor },
    { extend: "remove", editor: editor }
    ]

    i have change editor with my var js
    buttons: [
    { extend: "create", editor: table_user_edit },
    { extend: "edit", editor: table_user_edit },
    { extend: "remove", editor: table_user_edit }
    ]

This discussion has been closed.