Delete and Edit buttons not working
Delete and Edit buttons not working
Hello,
I need some help since I am becoming crazy tryring to reproduce this example in a real case.
https://editor.datatables.net/examples/advanced/formOnlyData.html
The code I developed gives me an error when I click on edit and delete button. The erro in the console is the following.
Uncaught Unable to automatically determine field from source. Please specify the field name. For more information, please refer to https://datatables.net/tn/11
This is the code I used.
http://debug.datatables.net/etacur
// DataTable
table = $('#children').dataTable({
dom: "Bfrtip",
ajax: "_php/dtChildren.php",
columns: [
{ data: null, defaultContent: '', orderable: false, width: "5%", sClass: "alignCenter" },
{ data: null, defaultContent: '', orderable: false, width: "15%",
render: function ( data, type, full ) {
var path = pad + data.child.account_id;
path = path.slice((path.length - 7),7);
return '<img src="__school_files\/' + path + '\/' + data.child.photo + '" class="img-circle" width="50" height="50">';
} // render
}, // photo
{ data: null, width: "50%", render: function (data, type, full) {
return data.child.last_name + ' ' + data.child.first_name;
}
},
{ data: "child.birth_date", width: "20%" },
{ data: null, defaultContent: '', sClass: "alignCenter", orderable: false, editField: "child.section_id", width: "15%",
render: function ( data, type, full ) {
return '<button class="btn btn-default btn-sm" style="background-color: '
+ data.section.color +'">' + data.section.name + '</button>';
} // render
} // data
],
select: true,
buttons: [
{ extend: "create", editor: editor },
{ extend: "edit", editor: editor },
{ extend: "remove", editor: editor }
],
aLengthMenu: [[5, 10, 25], [5, 10, 25]],
pageLength: 5
});
I do not understand what I miss and why the edit and delete butto do not work. I suspect it is due to the first column and the columns that are rendered.
ty
f
This question has an accepted answers - jump to answer
Answers
I have the same error! It's driving me crazy!
Hi,
Could you try the dev version of DataTables please. I believe that should resolve the issue.
Thanks,
Allan
THANK YOU! It did. It also resolved a small issue I had w/ select2 placeholders!
Thanks Allan. It worked for me also. I'll buy the license this week!
When will you release the stable version?
ty
f
Planning to release an update of DataTables next week - probably towards the end of the week to allow any other issues that exist to be found and be resolved.
Allan