'Print element does not print the page with the print button, but choosing the data does print it
There is a print button in my page, where it opens a popup. If I choose the text, it prints it. But, if I press the print button, it prints 2 blank pages. I tried printing other pages in the application, and they print normally. It's only the specific pop up that has the printing issue.
The code is typical, there are no errors in it:
ControlHandlers.GridPrint = function(iRecType, sIDs) {
setTimeout(function() {
try {
if (MenuFolders.AppMode == 2) {
$("#CalendarContainerDiv").printElement();
}
if (MenuFolders.AppMode == 3) {
$("#ActivitiesDiv").printElement();
}
if (MenuFolders.AppMode == 4) {
$("#ContactsDiv").printElement();
}
if (MenuFolders.AppMode == 5) {
if (mo_CustomPage == true) {
//PrintElem("ReportsContainerDiv");
$("#ReportsDivEmpty").printElement();
// window.print();
return;
}
if (!sIDs) {
sIDs = '';
}
if (!sIDs != '') {
var keys = BIGrid.getSelectedRowKeys();
if (keys.length > 0) {
for (i = 0; i < keys.length; i++) {
if (sIDs != '') {
sIDs = sIDs + ','
};
sIDs = sIDs + keys[i].toString();
}
} else {
ODCloseBusy();
ODAlert(ODGetMsg(2368));
return;
}
}
if (iRecType == 1) {
var query = {
iObjectID: BIObjectID,
iRecType: 1,
sIDs: sIDs
};
ODShowBusyWindow();
FileWindow = true;
//ShowReport("Download.html?v=2");
//if (app.isMobileView()) {
// FileWindow = window.open("Download.html?v=2", "_blank");
//} else {
// var sParams = "directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,width=" + Math.round(screen.width / 1.5) + ", height=" + Math.round(screen.height / 1.5) + ", top=" + ((screen.height / 2) - (screen.height / 1.5 / 2)) + ", left=" + ((screen.width / 2) - (screen.width / 1.5 / 2));
// FileWindow = window.open("Download.html?v=3", ODGetMsg(27), sParams);
//}
$.ajax({
type: "POST",
url: "WebMethods.aspx/WaitProcess",
//headers: { "Accept-Encoding": "gzip" },
data: JSON.stringify(query),
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
success: function(result) {
var sData;
sData = eval('(' + result.d + ')');
if (sData.err != "") {
ODAlertError(sData.err);
ODCloseBusy();
return;
}
DownloadFile(sData.data, "-1", "");
ODCloseBusy();
},
failure: function(msg) {
ODCloseBusy();
ODAlertError(msg);
},
error: function(a, b, c) {
ODCloseBusy();
ODAlertError(c + ' - ' + a.responseText);
}
});
return;
}; //EKTYPWSH LISTAS
if (BIGridPrintField != '') {
if (BIForcePrintFile != '') {
DownloadFile(BIForcePrintFile, "-1", "");
BIForcePrintFile = "";
return;
}
if (BIData && (BIData[BIGridPrintField] == '' || !BIData[BIGridPrintField])) {
ODAlertError(ODGetMsg(12061));
} else {
var FilesToPrint = '';
var selectedRowsData = BIGrid.getSelectedRowsData();
for (i = 0; i < selectedRowsData.length; i++) {
if (FilesToPrint != '') {
FilesToPrint = FilesToPrint + '|'
};
if (selectedRowsData[i][BIGridPrintField] != '') {
FilesToPrint = FilesToPrint + selectedRowsData[i][BIGridPrintField];
}
}
//BIData[BIGridPrintField]
DownloadFile(FilesToPrint, "-1", "");
}
} else {
$("#ReportsDiv").printElement();
}
}
} catch (e) {
ControlHandlers.ODAlertError(e);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
