How to obtain the id of delete button?
How to obtain the id of delete button?

I'm creating a DataTable like that:
t = $('#nuevoart').DataTable({
data:q,
columnDefs: [
{ type: 'currency', targets:3}
],
columns: [
{title: "ID",data:"details.id"},
{title: "COD.:",data:"details.cod"},
{title: "NOMBRE" ,data:"details.nombre"},
{title: "MARCA" ,data:"details.marca"},
{"title": "P/U ($)" ,data:"details.precio" },
{title: "CAT.:" ,data:"details.cat"},
{title: "SUBCAT.:" ,data:"details.subcat"},
{title:"IVA (%)",data:"details.iva"},
{ title:"ACCION",
data: null,
className: "center",
defaultContent: '<button type="button" class="editor_remove"><span class="fa fa-ok"></span><span
class="hidden-xs"> ELIMINAR</span></button>'
}
],
But i don't know how to assign for example details.id to the button id in order tu recognize what record is about. I'm working with php session to conservate the records.
I was trying it, because i have an autonumeric cod at the first colum(inline deleting).
var idregistro= $(this).parents("td:first").text();
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
This example uses
defaultContent
for the buttons. It doesn't use ID's for the buttons but gets theclosest( 'tr' )
.http://live.datatables.net/xijecupo/1/edit
If you need to use a unique ID for each button then you will want to use
columns.render
and themeta
parameter for the row ID. See this example:http://live.datatables.net/qemodapi/1/edit
Kevin