Naveed786 Posted August 2, 2020 Share Posted August 2, 2020 Hello All, I am currently working on export to pdf, below is the code, i am able to see the data is getting retrieved from mysql table. I am having 2 issue: 1. When data is getting retrieved one column is on left corner it's now showing the data as it's Sno it gets hidden from left corner. 2. Second issue when i click on the link it's just adding a # tag on the url nothing else. Please guide me to fix the code. <!DOCTYPE html> <html> <head> <Title> Export Supplier / Visiters Details</Title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"/> <script type="text/javascript" src="tableExport.js"></script> <script type="text/javascript" src="jquery.base64.js"></script> <script type="text/javascript" src="html2canvas.js"></script> <script type="text/javascript" src="jspdf/libs/sprintf.js"></script> <script type="text/javascript" src="jspdf/jspdf.js"></script> <script type="text/javascript" src="jspdf/libs/base64.js"></script> <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> </head> <?php $con=mysqli_connect("localhost", "root", "", "cvmsdb"); $qry="SELECT * FROM tblsupvisitor"; $result=mysqli_query($con, $qry); $records = array(); while($row = mysqli_fetch_assoc($result)){ $records[] = $row; } ?> <div class="row" style="height:300px;overflow:scroll;"> <table id="tblsupvisitor" class="table table-striped"> <thead> <tr class="warning"> <th>SNO.</th> <th>Full Name</th> <th>Mobile Number</th> <th>Address</th> </tr> </thead> <tbody> <?php foreach($records as $rec):?> <tr> <td><?php echo $rec['ID']?></td> <td><?php echo $rec['FullName']?></td> <td><?php echo $rec['MobileNumber']?></td> <td><?php echo $rec['Address']?></td> </tr> <?php endforeach; ?> </tbody> </table> </div> <li><a href="#" onclick="$('#tblsupvisitor').tableExport({type:'json',escape:'false'});"> <img src="images/icon/logo.png" width="24px"> Export to Pdf</a></li> <li><a href="#" onclick="$('#tblsupvisitor').tableExport({type:'json',escape:'false'});"><img src="images/icon/logo.png" width="24px">JSON (ignoreColumn)</a></li> </html> Kind Regards, Naveed. Quote Link to comment Share on other sites More sharing options...
requinix Posted August 2, 2020 Share Posted August 2, 2020 1 hour ago, Naveed786 said: 1. When data is getting retrieved one column is on left corner it's now showing the data as it's Sno it gets hidden from left corner. What? Screenshot? 1 hour ago, Naveed786 said: 2. Second issue when i click on the link it's just adding a # tag on the url nothing else. Check your browser's Javascript console for errors. 1 Quote Link to comment Share on other sites More sharing options...
Naveed786 Posted August 3, 2020 Author Share Posted August 3, 2020 (edited) 7 hours ago, requinix said: What? Screenshot? Check your browser's Javascript console for errors. Hi requinix, I am attaching the screen shot for the first part and for the second part also i am uploading the javascript console error if you can help me to understand these error shall i replace these libs if yes can you please refer me to right libs. Edited August 3, 2020 by Naveed786 Quote Link to comment Share on other sites More sharing options...
Naveed786 Posted August 3, 2020 Author Share Posted August 3, 2020 44 minutes ago, Naveed786 said: Hi requinix, I am attaching the screen shot for the first part and for the second part also i am uploading the javascript console error if you can help me to understand these error shall i replace these libs if yes can you please refer me to right libs. All errors are gone i copied the required plugins but the only issue now is table export function, please see the attached screen shot. Quote Link to comment Share on other sites More sharing options...
Naveed786 Posted August 3, 2020 Author Share Posted August 3, 2020 Hi, Just want to post update now all errors are gone, but only one issue once i click on export to pdf it's getting exported in .json instead of .pdf. Can anyone help me on this and first column is not appearing properly i have posted the screen shot. Kind Regards, Naveed. Quote Link to comment Share on other sites More sharing options...
Naveed786 Posted August 3, 2020 Author Share Posted August 3, 2020 Hello, Quick update on progress, I found there was some issue with java scripts I have updated with new java scripts from github but now it is working but now it gets exported in csv but I need in pdf, can anyone help me with libs and data table export pdf Java scripts please. Quote Link to comment Share on other sites More sharing options...
Naveed786 Posted August 3, 2020 Author Share Posted August 3, 2020 (edited) Thanks to all for help and guidance, it's working fine now the issue was with Java script @requinix thanks for the guidance it's always fantastic and great. One quick question i want to put some formatting in the file as currently it looks very simple and still first column serial number is getting hidden i can not see the number under it but when i export the data is there. Can any one help on this code is already posted above. Thanks in advance. Naveed. Edited August 3, 2020 by Naveed786 Quote Link to comment Share on other sites More sharing options...
Naveed786 Posted August 4, 2020 Author Share Posted August 4, 2020 Hi, Anyone can help on above query please..... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.