Getting value from hidden row column
Getting value from hidden row column
rpandit
Posts: 14Questions: 0Answers: 0
I have 7 columns in my datatable with 2nd column is invisible and storing Message Id. 3rd column is a checkbox which is visible and i am storing Message Id value there too. Currently when someone checks checkbox i am collecting Message Id value from the checkbox but i don't want to store Message Id value in checkbox instead would like to collect it from the invisible second column.I want to do that in my function event.
function saveCheckedMessages(){
var msgIds = new Array();
$("#tblInbox td input[type=checkbox]:checked").each(function () {
msgIds.push(convertStringToInt($(this).val()));
});
}
How can i achieve that?
here's the link for Datatable
http://debug.datatables.net/ecevic
function saveCheckedMessages(){
var msgIds = new Array();
$("#tblInbox td input[type=checkbox]:checked").each(function () {
msgIds.push(convertStringToInt($(this).val()));
});
}
How can i achieve that?
here's the link for Datatable
http://debug.datatables.net/ecevic
This discussion has been closed.
Replies
actually this is the correct link
http://debug.datatables.net/ajuhed
[code]
var table = $('#example').DataTable();
table
.column( 2 )
.flatten()
.map( function (idx, i) {
if ( $('input:checked', table.cell( idx, 2 ).node()).length ) {
return table.cell( idx, 1 ).data();
}
return null;
} )
.filter( function ( val ) {
return val !== null;
} );
[/code]
I haven't actually tested it, as I don't have a table with checkboxes to hand in it, but what it is doing is getting the row indexes for the table and looping over each (in the `map()` ) and adding the data from column index 1 if column index 2 has a checked input in it. Then the `filter()` is finally used to remove the null values.
Allan