dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41845
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21360: Changed the printDiv function for printing multiple divs
------------------------------------------------------------
revno: 21360
committer: jijukjose <jijukjose@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-12-07 15:57:49 +0100
message:
Changed the printDiv function for printing multiple divs
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2015-12-04 16:04:19 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2015-12-07 14:57:49 +0000
@@ -98,13 +98,15 @@
$scope.model= {};
$scope.printDiv = function( divName ) {
- var printContents = document.getElementById(divName).innerHTML;
- var originalContents = document.body.innerHTML;
- $scope.model.print_mode = true;
- document.body.innerHTML = printContents;
- window.print();
- document.body.innerHTML = originalContents;
- $scope.model.print_mode = false;
+ var elements = document.getElementsByClassName(divName);
+ var printContents = "";
+ for (var index = 0; index < elements.length; index++) {
+ printContents += elements[index].innerHTML;
+ }
+ var popupWin = window.open('', '_blank', 'width=800,height=800');
+ popupWin.document.open();
+ popupWin.document.write('<html><head><link rel="stylesheet" type="text/css" href="style.css" /></head><body onload="window.print()">' + printContents + '</html>');
+ popupWin.document.close();
}