Print screen from the button click of another screen.
Question
Application Type
Reactive

Hi,

My requirement is to print the screen in a4 size using  button click of another screen. 

Onclick of button i am redirecting the user to the screen which i need to print, i have used the javascript  window.print();

to print the screen. its working but only static data is getting displayed.

Which event i need to use to get all the data. or any other option please?


Thanks


mvp_badge
MVP

Hi Rajendra,

You had such observation because of the early window.print() call before the completion of data fetch operation for the screen aggregate(s)/Data Source action(s). I could suggest you two approaches to handle such a situation.


Sol. 1) Invoke the print method after a specific time duration, using the setTimeout(), which will be defined in the screen OnReady handler flow

for e.g.

setTimeout(function() {
    window.print();
}, 1000);


Sol. 2) Define the OnRender handler for the screen and execute the JS node, which includes the window.print(); function call, only if all the data source defined in the screen scope runtime IsDataFetched boolean property is true.

Aggregate.IsDataFetched


I hope this helps you!


Kind regards,

Benjith Sam

Thanks a lot Banjith,

But how can I hide the screen data to the user while loading the static content of the screen, because in this case for some second the simple screen will get display.



Thanks

Rajendra 

mvp_badge
MVP

Hi Rajendra,

Sorry! I'm not able to understand the mentioned use case completely. As per my understanding, there can be two possible cases i.e.

1) Navigate the end-user to the print screen and prompt the print window, by invoking the JS print method 

2) On click of the print icon, the end-user should be prompted with a print window without navigating to the print screen

I have created a sample app based on the above mentioned cases. Print Screen Demo

Refer to the attached .oml file

I hope this helps you!


Kind regards,

Benjith Sam

RWALabPrintScreen.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.