How to get the entire row of all checkbox checked?
How to get the entire row of all checkbox checked?

I'm using datatables with one column (first one) which includes checkboxes. I need to get all the rows that users checked the checkboxes.
Here is my code
Datatable initialisation:
[code]
/* Init the table */
var init = function(){
var oTable = $("#payed").dataTable({
"sDom" : 'lfrtipL',
"oSelectable" : defaults,
"aoColumns": [
{"sTitle" : "Select"},
{"sTitle" : "throw"},
{"sTitle" : "Type"},
{"sTitle" : "Total records"},
{"sTitle" : "Date loaded"},
{"sTitle" : "payed"}
]
,
"aoColumnDefs": [
{ "bSortable": true, "aTargets": [0,1,2,3,4,5] },
{ "sClass": "readonly", "aTargets": [0,1,2,3,4,5] },
{ "sClass": "editableCol", "aTargets": [ 0 ] },
{
"aTargets": [0], // Column number which needs to be modified
fnRender: function (o, v) { // o, v contains the object and value for the column
return '';
},
"sClass" : 'tableCell' // Optional - class to be applied to this table cell
},
{"sWidth": "7%", "aTargets": [0]}
],
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
{
$('td:eq(1)', nRow).html(new Date(aData[1]).customFormat( "#YYYY#-#MM#"));
$('td:eq(4)', nRow).html(new Date(aData[4]).customFormat( "#YYYY#-#MM#-#DD# #hhh#:#mm#:#ss# "));
$('td:eq(5)', nRow).html("0");
}
if ($('td:eq(0)').is(":checked")){
$(nRow).addClass('row_selected');
}
return nRow;
},
"fnCallback": function(json){
fnCallback(json);
},
'bAutoWidth': true,
"bProcessing": false,
"bServerSide": false,
"sAjaxSource": "ddjjCargada/getAllById",
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( jsonData );
$.getJSON( sSource, jsonData)
.done(function(json){
fnCallback(json);
})
.fail(function(error){
console.log("Error al cargar "+error);
alert("Error al cargar los datos del servidor, for favor intentelo mas tarde");
});
},
'bPaginate': true,
"iDisplayLength": 10,
"bFilter": true,
"bSort": true,
"bInfo": true,
"bJQueryUI" : true,
"iDisplay":'40000',
"sPaginationType": "full_numbers"
});
return oTable;
}
[/code]
Here is the code that i'm using to get the nodes:
[code]
var sendToServer = function(tabla){
$("#tSend").on('click' , function(){
var rows = $("#talonPago").dataTable().fnGetNodes();
for(var i=0;i
Here is my code
Datatable initialisation:
[code]
/* Init the table */
var init = function(){
var oTable = $("#payed").dataTable({
"sDom" : 'lfrtipL',
"oSelectable" : defaults,
"aoColumns": [
{"sTitle" : "Select"},
{"sTitle" : "throw"},
{"sTitle" : "Type"},
{"sTitle" : "Total records"},
{"sTitle" : "Date loaded"},
{"sTitle" : "payed"}
]
,
"aoColumnDefs": [
{ "bSortable": true, "aTargets": [0,1,2,3,4,5] },
{ "sClass": "readonly", "aTargets": [0,1,2,3,4,5] },
{ "sClass": "editableCol", "aTargets": [ 0 ] },
{
"aTargets": [0], // Column number which needs to be modified
fnRender: function (o, v) { // o, v contains the object and value for the column
return '';
},
"sClass" : 'tableCell' // Optional - class to be applied to this table cell
},
{"sWidth": "7%", "aTargets": [0]}
],
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
{
$('td:eq(1)', nRow).html(new Date(aData[1]).customFormat( "#YYYY#-#MM#"));
$('td:eq(4)', nRow).html(new Date(aData[4]).customFormat( "#YYYY#-#MM#-#DD# #hhh#:#mm#:#ss# "));
$('td:eq(5)', nRow).html("0");
}
if ($('td:eq(0)').is(":checked")){
$(nRow).addClass('row_selected');
}
return nRow;
},
"fnCallback": function(json){
fnCallback(json);
},
'bAutoWidth': true,
"bProcessing": false,
"bServerSide": false,
"sAjaxSource": "ddjjCargada/getAllById",
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( jsonData );
$.getJSON( sSource, jsonData)
.done(function(json){
fnCallback(json);
})
.fail(function(error){
console.log("Error al cargar "+error);
alert("Error al cargar los datos del servidor, for favor intentelo mas tarde");
});
},
'bPaginate': true,
"iDisplayLength": 10,
"bFilter": true,
"bSort": true,
"bInfo": true,
"bJQueryUI" : true,
"iDisplay":'40000',
"sPaginationType": "full_numbers"
});
return oTable;
}
[/code]
Here is the code that i'm using to get the nodes:
[code]
var sendToServer = function(tabla){
$("#tSend").on('click' , function(){
var rows = $("#talonPago").dataTable().fnGetNodes();
for(var i=0;i
This discussion has been closed.
Replies