Skip to Content

SAPUI5 print not showing content, only displaying empty form

Hi, I am trying to print a view created using xml in sapui5 which has few controls structured to display a form. I am using the following code to print the form which I found online var oTarget = this.getView(); if (oTarget) { var $domTarget = oTarget.$()[0], sTargetContent = $domTarget.innerHTML, sOriginalContent = document.body.innerHTML; document.body.innerHTML = sTargetContent; window.print(); document.body.innerHTML = sOriginalContent; } However the form structure is successfully getting created but its not picking the text field values which have been entered. The values are not coming from any db but from locally saved XML file . I am setting the value form this file to text fields in the form. On setting up the debugger I found that document. body.innerHTML has value parameter "". I tried setting the placeholder, value attribute of textfield on the click event of print button and before the above code snippet but it didnt work, also tried changing the innerhtml of that particular text field, didnt work. Please note I want to print the entire form and therefore I am fetching the body using innerhtml . Please help. Regards, Pooja

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers