How to update new data to a row properly ?
How to update new data to a row properly ?
ezsticker
Posts: 3Questions: 2Answers: 0
Debugger code (debug.datatables.net):
editor = new $.fn.dataTable.Editor({
ajax: "/cms_bs4/public/editer_tables/controllers/staff.php",
table: "#example",
template: '#customForm',
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"
}
]
});
var mytable=$('#example').DataTable({
dom: "Bfrtip",
ajax: "/cms_bs4/public/editer_tables/controllers/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: "edit",
editor: editor,
formButtons: [
{
label: 'update',
fn: function () {
console.log("do something...");
//then how to update this data
//mytable.submit();
}
},
]
},
]
});
Error messages shown: mytable.submit is not a function
Description of problem: I want do something,then update this data to client side and server side.
This discussion has been closed.
Answers
I have found the answer,tks.