How to see the data of a column that is hidden, but I need to display the content in a texbox
that is next to the datatable
.
Next I have the datatable
configured to hide the column.
$(document).ready(function() {
$('#example').DataTable( {
"columnDefs": [
{
"targets": [ 3 ],
"visible": false
}
]
} );
} );
Then to recover the data of the selected row I use the following function:
$(function() {
$('#example tbody').delegate("tr", "click", rowClick);
});
function rowClick()
{
if (hlr)
$("td:first", hlr).parent().children().each(function(){
$(this).removeClass('markrow');});
hlr = this;
$("td:first", this).parent().children().each(function()
{
$(this).addClass('markrow');
});
var valor= $("td:eq(3)", this).text();
//añadiendo el valor a un textbox
$("#textbox").html(valor);
}
The problem is that if the column is hidden, it no longer shows the value of column 3 but that of column 4 below.