Get the value of a textbox inside a datatable
Get the value of a textbox inside a datatable
MMar
Posts: 2Questions: 0Answers: 0
Hi everyone,
I have a datatable with 2 columns with a textbox and I don't manage to get the value. Here's thecode:
var nCloneTh3 = document.createElement('th');
var nCloneTd3 = document.createElement('td');
nCloneTd3.innerHTML = '<input type="checkbox" id="chkEsOT">';
nCloneTd3.className = "center";
$('#GVEPtesEntregadoJUST thead tr').each(function () {
this.insertBefore(nCloneTh3, this.childNodes[0]);
});
$('#GVEPtesEntregadoJUST tbody tr').each(function () {
this.insertBefore(nCloneTd3.cloneNode(true), this.childNodes[0]);
});
var nCloneTh2 = document.createElement('th');
var nCloneTd2 = document.createElement('td');
nCloneTd2.innerHTML = '<input type="text" with="100%" id="txtCli" >';
nCloneTd2.className = "center";
$('#GVEPtesEntregadoJUST thead tr').each(function () {
this.insertBefore(nCloneTh2, this.childNodes[0]);
});
$('#GVEPtesEntregadoJUST tbody tr').each(function () {
this.insertBefore(nCloneTd2.cloneNode(true), this.childNodes[0]);
});
var nCloneTh = document.createElement('th');
var nCloneTd = document.createElement('td');
nCloneTd.innerHTML = '<input type="text" with="100%" id="txtNumOTTicket">';
nCloneTd.className = "center";
$('#GVEPtesEntregadoJUST thead tr').each(function () {
this.insertBefore(nCloneTh, this.childNodes[0]);
});
$('#GVEPtesEntregadoJUST tbody tr').each(function () {
this.insertBefore(nCloneTd.cloneNode(true), this.childNodes[0]);
});
var otablaEPtesEntregadoJUST = $('#GVEPtesEntregadoJUST').dataTable({
"bRetrieve": true,
"bDestroy": true,
"bJQueryUI": true,
"bStateSave": true,
"iDisplayLength": 10,
"sPaginationType": "full_numbers",
"sScrollY": "100%",
"sDom": '<"H"fl>t<"F"ipT>',
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [0,1,2,3,4,5] },
{ "sTitle": "OT/Ticket", "sName": "nOTTicket", "aTargets": [ 0 ] },
{ "sTitle": "Cliente", "sName": "nCliente", "aTargets": [ 1 ] },
{ "sTitle": "Es OT", "sName": "nEsOT", "aTargets": [ 2 ] }
],
"oTableTools": {
"sSwfPath": "DataTables/extras/TableTools/media/swf/copy_cvs_xls_pdf.swf",
"aButtons": [
{
"sExtends": "xls",
"sToolTip": "Guardar como XLS",
"mColumns": "visible",
"bSelectedOnly": true
}]}
});
To get the values I want to use a button to read all the rows.
Any idea?
This discussion has been closed.
Replies
Here's the solution:
$('#btnJustificar').click( function() {
var numero = $('#GVEPtesEntregadoJUST').dataTable().fnGetNodes().length;
var vCliente;
var vOTTicket;
var vEsOT;
if (numero != 0) {