3

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.

8
  • can u make a simple plunkr so we can help Commented Sep 28, 2017 at 13:00
  • @PanosK Here is the plunker plnkr.co/edit/7OfKd7xbRHkzFIPlpWS7?p=preview Commented Sep 28, 2017 at 13:03
  • ok probably i didnt fully understood the question where you want to print all the data Commented Sep 28, 2017 at 13:18
  • @PanosK, As shown in the fiddle, i m able to print only first page, but my requirement is to print all 10 pages. Commented Sep 28, 2017 at 13:25
  • items per page input isnt supposed to work if you set it 100? you want to print 100 records even if your item per page is set to 10? Commented Sep 28, 2017 at 13:33

1 Answer 1

3

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

  1. loclist is the array that need to print.
  2. i have created the html page in the controller and based on that i am rendering the data and also checking the required conditions.
  3. Using the Localstorage get and set method able to get data.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.