Maintaining state in Vaadin on browser back button - vaadin

Vaadin loses the content on pressing the browser back button. If I have populated a table and if I go back to that page, the page is empty again. How can I save state of pages so that when I go back to them using browser back button they're in the state I left them.
I am using Navigator currently.
I am basically uploading an excel sheet using Upload component, and populating my table on the same page using table.additem(). I have a functionality that when user clicks on a row of the table, user navigates to the next page, but when I press the browser back button then the table is gone, and the upload shows no document selected.
The navigation updates Application/#!Main/ the variable part changes.
I just want my application to retain the state as it would do with a refresh.

I found the same issue. You should add scope #UIScope to your views, in this scope session works, and state will be saved.

Related

How to display user entered data when we came back to previous page

when user fill all the fields of a page and click on continue user will navigate to next page. if he click on back button he'll navigating to previous page but the data entered by user is not showing.
autocomplete attribute is not working.

How to disable back operation of Flutter's Navigator class

After a login page, a page gets replaced by an overview page like so:
Navigator.popAndPushNamed( context, MyApp.ROUTE_TESTER_TASK_OVERVIEW );
This removes the current page from the Navigator's stack and pushes the new page on it. Fine.
Q: But how to I disable, that a user performs a back navigation? The user shouldn't bee able to leave the Task Overview page.
Should I keep the stack holding one and only one page all the time.
Or does Navigator has another option to disable a back navigation?
Q: Additionally, I want to disable the swipe right gesture, so than it doesn't show the previous page [as I the user clicked Android's back button].
One possible (probably not the best) solution is to wrap the second page within a WillPopScope widget. In the onWillPop parameter you can just return Future.value(false) to intercept all pop actions.

Retaining values of controls in MVC 3 after moving to new page

I am new to MVC 3. I have a page (for eg: "Master Page") where I have some dropdown boxes to select values and click on "Go" button (type = "Button"). Based on the selection, I am filing a grid. One of the columns in the grid will have hyperlink. Upon clicking the hyperlink, opens another page (for eg: "details Page") to display other details. Now if the user click on browser back button, the values in the controls of "Master Page" is empty. How to retain the values in the dropdown boxes and grid on "Master Page".
You're relying on behavior of the browser. Some browsers can keep this data, others don't. So it's up to programmer decide where the data must be stored. In common cases you can use the following approaches:
If you make a wizard, just make some div's hidden (you will keep wizard's steps in there), and make your own next/back buttons inside of your wizard. When the user tries to go back and next, he won't go to another page, but will switch between steps via JavaScript inside of one page (all data will be kept).
You can do the same, but keeping your data on the server. In this case, by clicking on the button, your data will be kept in the database. And will be reloaded again when the user goes back.
You can manually save data to cookies. It's okay if you have small amounts of data to be kept.

Calling rowToggle on Page Load using Prime Faces?

I am using primefaces 3.5, the latest release for our development work! In our homepage, we display the rows of data. When we click a row onRowSelect (SelectEvent) event we navigate to the next page with the Navigation Handler. On this landing page, I have a dataTable with expandable rows which has data in it. When I click the rowToggle icon the data is displayed in row expansion section (as it should normally).
What I need is to show the data automatically when page is loaded, with the rowToggler displaying down.
How can I achieve this?
This can be achieved using a bit of JavaScript (jQuery). All you have to do, is as your page loads call the click action of the RowExpander.
Something like this would work :
jQuery('.ui-row-toggler').click()
You can place this in your body onLoad attribute.
Source
http://forum.primefaces.org/viewtopic.php?f=3&t=8537

jQuery Mobile - Page is not reloading

I am new to jQuery Mobile. I am trying to move from page #one1 to #page2. #page2 contains an address book form. If I fill something in the form and click on the back button to move to #page1 and then I again move to #page2, the form will show all the previously filled data.
I want that when I go back to #page2 all the fields be blank.
I have also tried it with putting an alert. The alert will popup the first time but it is not showing when I revisit this page again.
$('#page2').live('pageinit',function(event){
alert("Edit");
});
Thanks
Vivek
In the button that shows up #page2, don't move right away to #page2, first call a function that clears the fields. And then you can move to #page2...

Resources