Reputation: 941
I am using dirPagination.js for pagination of table in angular js. I want to print all the data present in the Table. I have tried some ways but I am only able to print current page data. Can anyone let me know to print all data present in table having pagination.
Please let the question get answered instead of marking duplicate or useless question, better help.
Upvotes: 3
Views: 2638
Reputation: 941
Very Simple. Here i have done printing of all the data of table.
var popupWin;
$scope.printDiv = function(divName,loclist) {
console.log(divName)
console.log(loclist.finalarr)
localStorage.setItem('itemKey', JSON.stringify(loclist.finalarr));
popupWin = window.open('', '_blank');
popupWin.document.open();
popupWin.document.write('<html ng-app="dumb"><head><link href="css/bootstrap.min.css" rel="stylesheet"><link href="fonts/css/font-awesome.min.css" rel="stylesheet"><link href="css/custom.css" rel="stylesheet"><script src="script/lib/jquery-2.2.0.min.js"></script> <script src="script/lib/angular.js"></script><script src="script/lib/ngStorage.min.js"></script></head><body onload="window.print();window.close()" ng-controller="dumbconr"><table class="table table-striped responsive-utilities jambo_table bulk_action" style="font-size:10px;"><thead><tr class="headings"> <th>S.No</th><th>Tool</th><th>Action Done</th><th>User</th><th>Assigned To</th><th>FollowUp Date</th><th>Contact Name</th><th>Company Name</th><th>Phone</th><th>City</th><th>Product</th><th>Dealing Product</th><th>Result</th><th>Action to be done</th><th>Next FollowUp</th></tr></thead><tbody><tr class="even pointer" ng-repeat="data in lli"><td>{{$index+1}}</td><td>{{data.tool}}</td><td>{{data.followups.actiondone}}</td><td>{{data.empid}}</td><td>{{data.followups.assignedto}}</td><td>{{data.followups.followup| date: "dd MMM yyyy"}}</td><td>{{data.name}}</td><td>{{data.firmname}}</td><td>{{data.contact}}</td><td><span ng-if="data.city">{{data.city}}<span><span ng-if="!data.city">-<span></td><td>{{data.product}}</td><td>{{data.dproduct}}</td><td>{{data.followups.result}}</td><td>{{data.followups.nextaction}}</td><td>{{data.followups.nextfollowup | date: "dd MMM yyyy"}}</td></tr></tbody></table><script>var app=angular.module("dumb", ["ngStorage"]).controller("dumbconr",function($scope, $localStorage, $rootScope){ $rootScope.lli=JSON.parse(localStorage.getItem("itemKey"));})</script></body></html>');
popupWin.document.close();
}
Here
Upvotes: 3