I have the following code in jQuery
var fila;
$(document).ready(function(){
acciones_filas('tbl_producto', 'acciones-activos', productoTable);
$("#id_producto").val(fila.nProCodigo);
}
function acciones_filas(tabla_id, acciones_id, tabla_objeto, fila)
{
//click on a row
$("#"+tabla_id+" tbody").on('click', 'tr', function(){
$("#"+acciones_id+" .btn").removeAttr('disabled');
if ( $(this).hasClass('row_selected') ) {
$(this).removeClass('row_selected');
}
else {
tabla_objeto.$('tr.row_selected').removeClass('row_selected');
$(this).addClass('row_selected');
}
if($('#'+tabla_id+' .row_selected').length < 1)
$("#"+acciones_id+" button").attr('disabled', 'disabled');
fila = tabla_objeto.fnGetData(this);
});
}
When I click on a row of a table the variable fila
must save the value of the selected row, but when I print the result I get and undefined