How to not export a row if it has a defined column value empty or 0?
How to not export a row if it has a defined column value empty or 0?
I want to export a html table to PDF and i have used datatable plugin to do so.
I have a table like:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Data Table Filtering </title>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/r/dt/jq-2.1.4,jszip-2.5.0,pdfmake-0.1.18,dt-1.10.9,af-2.0.0,b-1.0.3,b-colvis-1.0.3,b-html5-1.0.3,b-print-1.0.3,se-1.0.1/datatables.min.css"/>
</head>
<body>
Data Table PDF Filtering
Name | Bank Account |
Salary |
---|---|---|
AAA | 31-1296-52 | 5000 |
BBB |
5000 | |
CCC | 30-1596-82 | 5000 |
DDD | 28-1396-65 | 5000 |
EEE | 5000 |
<script type="text/javascript" src="https://cdn.datatables.net/r/dt/jq-2.1.4,jszip-2.5.0,pdfmake-0.1.18,dt-1.10.9,af-2.0.0,b-1.0.3,b-colvis-1.0.3,b-html5-1.0.3,b-print-1.0.3,se-1.0.1/datatables.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('table#employee_grid').DataTable({
"processing": true,
"bPaginate": false,
"bInfo": false,
"dom": 'lBfrtip',
"buttons": [
{
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'A4',
text: 'Bank Statement',
exportOptions: {
//exportOptionConditionHere
}
},
{
extend: 'excelHtml5',
}
],
"select": true
});
} );
</script>
</body>
</html>
Now, what I need to do is to only take those rows which has Bank Account column value not empty. How do I write condition on export options so as to make my requirement possible.
But i did not know how to write condition inside the export option
Answers
Hi @aleshdulal ,
If you take a look at this example here, you'll see something similar. The export only contains rows when the second column matches "London". You can do something similar wit h your account check.
Hope that helps,
Cheers,
Colin