Hi everyone,
I have a little application with a grid. I load the grid data with SQL and run a java script program which visualizes a route on map in a html container (screen A). This works fine.
Now I select a row in the grid and click on a button which calls another program which completely replaces the screen A with a different screen (screen B). When I click the back button on screen B, the program returns to screen A.
Unfortunately, on screen A, the with java script visualized route is now gone (not visible anymore). To solve this problem, I have to run the SQL, reload the grid and run the java script program again. And I even have to set a grid row as selected. This works, but takes a lot of time.
My question: Is there a way to save screen A before calling the program which displays screen B so I don't have to reload all the data again? Or is there a way to save the with java script filled html container ? This would help a lot.
Thank you very much for your answer in advance.
If you have any questions, feel free to ask.
Christoph
Is it possible to save a screen or a html container ?
-
- Profound User
- Posts: 53
- Joined: Tue Jan 27, 2015 8:13 am
- First Name: Christoph
- Last Name: Seitz
- Company Name: Waser + Co. AG
- Phone: +41 44 94 74 341
- Address 1: Erlenwiesenstrasse 2
- City: Volketswil
- State / Province: Outside Canada/USA
- Zip / Postal Code: 8604
- Country: Switzerland
- Contact:
- Glenn
- Profound Logic Staff Member
- Posts: 124
- Joined: Mon Apr 14, 2014 4:08 pm
- First Name: Glenn
- Last Name: Hopwood
- Company Name: Profound Logic Software
- State / Province: Ohio
- Country: United States
- Contact:
Re: Is it possible to save a screen or a html container ?
When you say "back button on screen B" do you mean the browsers "back" button or one in your application?
Glenn
Glenn
-
- Profound User
- Posts: 53
- Joined: Tue Jan 27, 2015 8:13 am
- First Name: Christoph
- Last Name: Seitz
- Company Name: Waser + Co. AG
- Phone: +41 44 94 74 341
- Address 1: Erlenwiesenstrasse 2
- City: Volketswil
- State / Province: Outside Canada/USA
- Zip / Postal Code: 8604
- Country: Switzerland
- Contact:
Re: Is it possible to save a screen or a html container ?
It is a "back" button in my application.
Christoph
Christoph
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Is it possible to save a screen or a html container ?
What happens in your program when the "back" button is clicked?
In my programs, the back button would simply return control to the program that displayed "screen A". That program would do it's EXFMT again, so now the display would be re-run. At this point, my JavaScript code that built the map would also re-run, making the same screen as before.
How does yours work?
You ask about saving the HTML container... you could do that, just retrieve the contents of the html container, and save them into a variable, cookie or local storage. (Whichever makes the most sense for your application.) Then when the screen is displayed, your onload code could see the data has been stored, and put that data back into the container.
Would that work?
In my programs, the back button would simply return control to the program that displayed "screen A". That program would do it's EXFMT again, so now the display would be re-run. At this point, my JavaScript code that built the map would also re-run, making the same screen as before.
How does yours work?
You ask about saving the HTML container... you could do that, just retrieve the contents of the html container, and save them into a variable, cookie or local storage. (Whichever makes the most sense for your application.) Then when the screen is displayed, your onload code could see the data has been stored, and put that data back into the container.
Would that work?
-
- Profound User
- Posts: 53
- Joined: Tue Jan 27, 2015 8:13 am
- First Name: Christoph
- Last Name: Seitz
- Company Name: Waser + Co. AG
- Phone: +41 44 94 74 341
- Address 1: Erlenwiesenstrasse 2
- City: Volketswil
- State / Province: Outside Canada/USA
- Zip / Postal Code: 8604
- Country: Switzerland
- Contact:
Re: Is it possible to save a screen or a html container ?
Thank you for your answer.
My application works as follows:
1. In RPG program A I display screen A (grid on the left and visualized route on the right in a html container created with java script code via onload event).
2. Now I click on a row in the grid and click on a button.
3. Now in RPG program A I call RPG program B which displays screen B (screen B completely overwrites screen A).
4. In RPG program B in screen B is a back button. Now I click on this back button and RPG program B ends.
5. RPG Program A now sends an EXFMT FMT01 (in the onload event I do not run the java script code again to achieve the best performance possible).
6. Screen A is now visible: The grid on the left including data and selected row is still there but the html container on the right is gone (not visible anymore).
You wrote that it is possible to save and restore a HTML container. I tried to do this but it didn't work unfortunately.
How can I save the html container contents into a variable?
Do I have to create a variable in the visual designer or in the java script code? And what type of variable do I have to create?
Do I need a field which is bound to the html container?
Thank you very much for your help in advance.
Christoph
My application works as follows:
1. In RPG program A I display screen A (grid on the left and visualized route on the right in a html container created with java script code via onload event).
2. Now I click on a row in the grid and click on a button.
3. Now in RPG program A I call RPG program B which displays screen B (screen B completely overwrites screen A).
4. In RPG program B in screen B is a back button. Now I click on this back button and RPG program B ends.
5. RPG Program A now sends an EXFMT FMT01 (in the onload event I do not run the java script code again to achieve the best performance possible).
6. Screen A is now visible: The grid on the left including data and selected row is still there but the html container on the right is gone (not visible anymore).
You wrote that it is possible to save and restore a HTML container. I tried to do this but it didn't work unfortunately.
How can I save the html container contents into a variable?
Do I have to create a variable in the visual designer or in the java script code? And what type of variable do I have to create?
Do I need a field which is bound to the html container?
Thank you very much for your help in advance.
Christoph
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Is it possible to save a screen or a html container ?
My thought was that you'd do this in JavaScript. I don't think binding a variable can work since HTML Containers are not input fields, so their data is not sent to the host.
I'm not familiar with your HTML container or how it works. I was hoping that it was as simple as doing this:
in the onsubmit event:
in the onload event:
So when the screen is submitted to the server (so that the RPG program can display screen B) it saves the contents of the HTML container into a variable named CHS_Saved_HTML. (Starting a variable with "window." makes it global.) When the screen displays again, it looks for that variable and if it is there, sets the contents of the HtmlContainer to the variable.
If your session gets "refreshed" (for example, due to a "Refresh interval" or a call to the pui.refresh() routine) the contents of the variable will be lost. So it might be a better idea to save the data into "localStorage" instead, since this will not be lost.
I am doing a lot of guessing about how your application works, and may be wrong.
I'm not familiar with your HTML container or how it works. I was hoping that it was as simple as doing this:
in the onsubmit event:
Code: Select all
window.CHS_Saved_HTML = getObj("Your-HtmlContainer-Id").innerHTML;
Code: Select all
if (window.CHS_Saved_HTML) {
getObj("Your-HtmlContainer-Id").innerHTML = window.CHS_Saved_HTML;
}
If your session gets "refreshed" (for example, due to a "Refresh interval" or a call to the pui.refresh() routine) the contents of the variable will be lost. So it might be a better idea to save the data into "localStorage" instead, since this will not be lost.
I am doing a lot of guessing about how your application works, and may be wrong.
-
- Profound User
- Posts: 53
- Joined: Tue Jan 27, 2015 8:13 am
- First Name: Christoph
- Last Name: Seitz
- Company Name: Waser + Co. AG
- Phone: +41 44 94 74 341
- Address 1: Erlenwiesenstrasse 2
- City: Volketswil
- State / Province: Outside Canada/USA
- Zip / Postal Code: 8604
- Country: Switzerland
- Contact:
Re: Is it possible to save a screen or a html container ?
Thanks a lot for your information.
Saving the HTML container to a variable and restoring it worked.
Happy Easter!
Christoph
Saving the HTML container to a variable and restoring it worked.
Happy Easter!
Christoph
Who is online
Users browsing this forum: No registered users and 0 guests