Add custom column
Add custom column
Hi, i'm new to this forum and i want to begin to use datatables,
I've a simple question:
How i can add a custom column that contain a form and button who can redirect with a post action to an another page?
I'm using the last version of datatables and the data is retrived by an ajax request to mysql database.
Here is the script code:
$(document).ready(function() {
$('#example').dataTable( {
"processing": true,
"serverSide": true,
"ajax": {
"url": "server_processing.php",
},
} );
} );
Thanks in advance.
This question has an accepted answers - jump to answer
Answers
in the columns for exemple. This is a custom column
can you post a image for the full code? because this doesnt' work for me.
Thanks you
"columns": [
{
data: null,
className: "center",
defaultContent: 'your html code'
}
]
and don't forget to add the column to the HTML table
i've add a column with the class center but this dont' works for me ...
Below is the source:
thanks a lot
show me your javascript plz
Thanks for your answers below are the html and Javascript files
if can help i post the server_processing.php below:
I don't see any of @lifedaniel's suggestion in your above code. You might want to review the documentation for
columns.defaultContent
and also this Editor example which makes use of that method: https://editor.datatables.net/examples/simple/inTableControls.htmlAllan
thanks you very much now it works