How to add new data to a row properly ?
How to add new data to a row properly ?

Link to test case: it can't be finded yet.
Debugger code (debug.datatables.net):
$('#example').DataTable({
dom: "Bfrtip",
ajax: "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",
text: 'new',
editor: editor,
formButtons: [
{
label: 'cancel',
fn: function () {
this.close();
}
},
{
label: 'create',
fn: function () {
// TypeError: editor.row is undefined
editor.row.add({
"Name": "test name",
"position": "test position",
}).draw();
}
},
]}
]
});
Error messages shown: TypeError: editor.row is undefined
Description of problem: How to code this features properly ? tks.
This discussion has been closed.
Answers
Yep,
editor.row()
isn't a method. This example here might help, it's showing how to create an empty row from a button, so similar to what you're trying to achieve.Colin