java - Export paginated table in html to PDF,CSV,XLS -
i trying export html table using js provided ngiriraj table export demo. table paginated bootstrap-table.js .
when exporting data in format 1 table page getting exported.
also, while exporting pdf, getting 4 columns in pdf.
code attached below.
jsp page:
<div style="padding: 10px;"> <br> <table id="table" data-search="true" data-show-columns="true" data-pagination="true"> <thead> <tr> <c:foreach items="${keys}" var="keys"> <th data-field="${keys}" data-sortable="true">${keys}</th> </c:foreach> </tr> </thead> </table> <nav class="navbar navbar-default export"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="#">download grid data as</a> </div> <ul class="nav navbar-nav"> <li><a href="#" onclick="$('#table').tableexport({type:'excel',escape:'false'});">xls</a></li> <li><a href="#" onclick="$('#table').tableexport({type:'csv',escape:'false'});">csv</a></li> <li><a href="#" onclick="$('#table').tableexport({type:'pdf',escape:'false'});">pdf</a></li> <li><a href="#" onclick="$('#table').tableexport({type:'json',escape:'false'});">json</a></li> </ul> </div> </nav> </div>
i have included .js files as:
<script src="${pagecontext.request.contextpath}/static/js/jquery.min.js"></script> <script src="${pagecontext.request.contextpath}/static/js/tableexport.js"></script> <script src="${pagecontext.request.contextpath}/static/js/jquery.base64.js"></script> <script src="${pagecontext.request.contextpath}/static/js/base64.js"></script> <script src="${pagecontext.request.contextpath}/static/js/sprintf.js"></script> <script src="${pagecontext.request.contextpath}/static/js/jspdf.js"></script>
for above .js files please refer ngiriraj table export demo.
thanks in advance.
Comments
Post a Comment