How to get ids of selected rows and serialize them?
How to get ids of selected rows and serialize them?
Hi, I'm missing something here. I would like to get a serialized value of selected ids in a table. This is what I have:
[code] $('.data-table tr').click(function() {
$(this).toggleClass('row_selected');
});
var oTable = $('.data-table').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
//"sDom": '<"toolbar">frtip',
"sDom": 't<"F"p><"toolbar">',
"aoColumnDefs": [{"bSortable": false, "aTargets": [0]}]
});
function fnGetSelected(oTableLocal)
{
return oTableLocal.$('tr.row_selected');
}
$('#action_menu #close_tickets').click(function(e) {
alert(fnGetSelected(oTable));
e.preventDefault();
});[/code]
[code] $('.data-table tr').click(function() {
$(this).toggleClass('row_selected');
});
var oTable = $('.data-table').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
//"sDom": '<"toolbar">frtip',
"sDom": 't<"F"p><"toolbar">',
"aoColumnDefs": [{"bSortable": false, "aTargets": [0]}]
});
function fnGetSelected(oTableLocal)
{
return oTableLocal.$('tr.row_selected');
}
$('#action_menu #close_tickets').click(function(e) {
alert(fnGetSelected(oTable));
e.preventDefault();
});[/code]
This discussion has been closed.
Replies
$( 'tr.row_selected' ).map( function () {
return this.id;
} );
[/code]
will give you an array of the ids, based on the selector.
Allan