How can i export(csv,excel,pdf) Filtered gridview records using datatable. My Code Is Below.
How can i export(csv,excel,pdf) Filtered gridview records using datatable. My Code Is Below.

Hi All ,
I Am new to data table table tools my gridview is filterable,when i am filter the records and export the grid it show me all records not filtered records,i want only Filtered records to export Following is my Code
var table = $('.data-grid1').DataTable({
"order": [[1, "desc"]],
dom: 'T<"clear">lfrtip',
oTableTools: {
"sSwfPath": "assets/DataTables-1.10.7/extensions/TableTools/swf/copy_csv_xls_pdf.swf",
"aButtons": [{
"sExtends": "collection",
"oSelectorOpts": { filter: 'applied', order: 'current' },
"sButtonText": "Export",
"aButtons": ["csv", "xls", "pdf", "print"]
}]
}
});
This discussion has been closed.
Answers
Hello Friends I have Solution now to export only Filtered Records.Following is My Code.
$('.data-grid1 tfoot').html("<tr></tr>");
$('.data-grid1 thead th').each(function () {
$('.data-grid1 tfoot tr').append('<th rowspan="1" colspan="1"></th>');
});
$('.data-grid1 tfoot th').each(function () {
var title = $('.data-grid1 thead th').eq($(this).index()).text();
if (title != "Action") {
$(this).html('<input type="text" class="form-control" />');
}
else {
$(this).html('<input type="text" disabled class="form-control" />');
}
});