Get hidden row value
Get hidden row value
Hi, please show me how i can alert() a value in the table row from clicking a row link. eg
-------------- initialisation code, data loaded through ajax -------------
"columns": [
{ data: 0 },
{ data: 1 },
{ data: 2 },
{ data: 3 },
{ data: 4 },
{ data: 5 },
{
data: null,
className: "center",
defaultContent: '<a href="" class="editor_edit">Edit</a> / <a href="" class="editor_remove">Delete</a>'
}
]
QUESTION - how do i alert the data [2] value?
$('#data-grid').on('click', 'a.editor_remove', function (e) {
e.preventDefault();
alert("delete pressed"); //works
what is the code to alert the data[2] value? (i need to pass to modal form)
} );
Thanks in advance for your help.
Paul
Answers
Check out the example on this page:
https://datatables.net/reference/api/cell().data()
It shows how to retrieve the value of a cell clicked on
Thanks, But how do you get the value from a different cell in the row?
use the index of the column, or name and append it to the data():
This will get whatever is in the second column of the row clicked to alert (array starts at 0).