showing fewer rows in save, csv, excel, pdf
showing fewer rows in save, csv, excel, pdf
Hi -
I am new to data tables and I was able to integrate successfully for basic use case. The problem that I am seeing is below:
a) I have 4 rows in my table. They are sent from servlet to jsp and are displayed correctly on the page
b) I am able to print out the table and it has all 4 rows as expected.
c) But for some reason, data tools ( and table tools) seems to think that it has only one row ("Showing 1 to 1 of 1 entries"). Though I can see all 4 rows in printed table. I tried selected any row after first data row and they cannot be selected or not visible from search
d) I am seeing only 1 row when I print using pdf or csv
I would appreciate any help I can get for me to resolve this issue and try out other features. So far, this seems like we have lot of value. Please let me know if you need any additional information. JSP code is below
thanks
Raj
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Account Details</title>
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.4/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="scripts/dataTables.tableTools.css">
<style type="text/css">
table {
border: 1px solid black;
border-collapse: collapse;
width: 50em;
}
th,td {
border: 1px solid black;
text-align: left;
padding: .5em;
}
button {
display: block;
width: 134px;
height: 35px;
border: 0 none;
font-weight: bold;
text-align: center;
color: #fff;
cursor: pointer;
position: relative;
float: left;
}
excelbutton {
background: red;
padding-left: 0px;
margin-right: 10px;
}
pdfbutton {
background: green;
}
</style>
</head>
<body>
<h3 id="titleh3">Account Details</h3>
<c:set var="listSize" scope="session" value="${acctListSize}"/>
<c:set var="acctiden" scope="session" value="${acctid}"/>
<input id="acctid" value="${acctiden}" type="hidden"/>
<table id="accountDataTable" >
<thead>
<tr>
<th>Account ID</th>
<th>Name</th>
<th>Company</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Account ID</th>
<th>Name</th>
<th>Company</th>
</tr>
</tfoot>
<c:forEach var="account" items="${listHolder.accounts}" begin="0"
end="${acctListSize}" step="1" varStatus="status">
<tbody>
<tr>
<td><c:out value="${account.acctId}" /></td>
<td><c:out value="${account.name}" /></td>
<td><c:out value="${account.company}" /></td>
</tr>
</tbody>
</c:forEach>
</table>
<hr>
<button id="excelbutton" type="button">Generate Excel Report</button>
<button id="pdfbutton" type="button">Generate PDF Report</button>
<br />
<script>
$(document).ready(function() {
$("#titleh3").append(" for ID: ").append($("#acctid").val());
$("#accountDataTable").DataTable( {
dom: 'T<"clear">lfrtip',
tableTools: {
"aButtons": [
"copy",
"csv",
"xls",
{
"sExtends": "pdf",
"sPdfOrientation": "landscape",
"sPdfMessage": "Your custom message would go here."
},
"print"
],
"sSwfPath": "http://cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls_pdf.swf"
}
} );
});
</script>
</body>
</html>