我已经使用sapui5中的网格创建了一个表单,一切正常,但是在将值输入到输入字段并按下“打印”按钮后,打印仅显示空白的输入字段。如何使用用户输入的输入值打印表格[注意:如果输入字段值是硬编码的,则表示正在打印]。我也想以base64格式捕获所有表单并将其发送到后端。我需要有关此代码的帮助。 这是代码:
onPrint: function (oEvent) {
debugger;
var linksArray = [];
var gridId = this.getView().byId("print1--gridUKBol").sId;
var secId = document.getElementById(gridId).parentNode.id;
$.each(document.styleSheets, function (index, oStyleSheet) {
if (oStyleSheet.href) {
debugger;
var link = document.createElement("link");
link.type = oStyleSheet.type;
link.rel = "stylesheet";
link.href = oStyleSheet.href;
linksArray.push(link.href);
//win.document.getElementsByTagName("head")[0].innerHTML = win.document.getElementsByTagName("head")[0].innerHTML + link.outerHTML;
}
});
var hContent = '<html><head>';
for (var i = 0; i < linksArray.length; i++) {
hContent += '<link rel="stylesheet" href=' + linksArray[i] + ' type="text/css" />';
}
hContent += '</head><body>';
var bodyContent = document.getElementById(secId).innerHTML;
var closeContent = "</body></html>";
var htmlpage = hContent + bodyContent + closeContent;
var random_win_name = Math.floor(Math.random() * 10);
var random_win_height = screen.height / 2;
var random_win_width = screen.width / 3;
var Pop_Win = window.open();
// var Pop_Win = window.open("", random_win_name, 'height=' + random_win_height + ',width=' + random_win_width);
Pop_Win.document.write(htmlpage);
}