angular <back> that preserves state - angularjs

I have 2 angular pages
Load page 1 which shows a big table of stuff, set some filters to find what you want, click the row in the table to get more details (loads page 2 which provides details).
From page 2, Press back button, page 1 loads from scratch, without the filter the user entered
Is there a way to preserve the filter the user has set when he goes back to page1? Is there a way I can keep the table where it was (e.g., if the user has scrolled halfway down, it returns where he was, rather than to the top of the table)
I could do this manually (pass the filter to the details page, then pass it back when user hits and scroll him back to where he was in the table), but this feels painful.

Related

How do I Print The Whole Contents Of A Paginated AngularJS UI-Grid On An MVC Page?

I have an MVC page, with data being displayed in an AngularJS UI_Grid, which is all working fine, and showing 10, 20 or 50 rows to a page.
However, I need to be able to print the whole list of data, even the rows that are displayed due to the pagination, all at once. Has anyone succeeded in doing this yet please?
If you want to effectively print a different page (one view has paginated data, the other one has the whole set at once), it's usually best to provide a "print" button which opens a different view in a pop up that includes the other data. In this case, a non paginated view.
That page can then automatically do a window.print(); when all the data is rendered, and then close itself, so that the user doesn't have to do anything other than hit the print button.

How to control scroll view of sdk:DataGrid in Silverlight 4.0?

I have a page called Personal Info which has DataGrid which has huge data.
For Example, User wants to update Customer ID - "GALED", On double click of that row it'll pop up Update Page which shows data related to Customer ID - "GALED". After updation the Personal Info page gets refreshed so that the changes will be reflected. But because of that it resets the position of scroll and every time the user has to scroll it down to update next data, in this case Customer ID - "FURIB".
I need code which will automatically set Scroll to previous position so that user don't have scroll it down.

Pages getting refreshed while switching between tabs

I have a web page done in AngularJS. I got four tabs. In my first tab there are a set of images which I can select,
When i switch between tabs,and come back to the first page, the page gets refreshed and I loose what ever I have done in my 1st tab. Like tab gets refreshed like it was loaded again.In this 1st tab I got some drill downs ass well. That also gets reset.
How can I avoid this.

How can I go back to a search result table that is in a partial view?

I'm working in a ASP.NET MVC project that accesses an SQL database and allows the user to search and view the data. Let me describe it:
I have a view with a search filter. When I click in a search button in this view, the controller returns a partial view with a table with some data, which appears below the filter. Then, I can click in an actionLink of a row to go to another view with the details. In the Details view I have a "back to list" button.
When I click in "back to list", I want the view, that has the filter and the partial view, to appear exactly as it was before. How can I do this?
My "back to list" is an actionlink that goes to the view. The problem is that, when I click in "back to list", the partial view with the table doesn't appear because it is necessary to click in the submit button first. How could I force the submit button through the controller?
This isn't really a problem that is solved inherently with MVC. It's really just a state concern, where you need to persist the state of a page, and resume that state when coming back to it.
This can be solved through typical means of persisting state between pages:
1) Save your search criteria in the session, and retrieve them when returning to the page.
2) Pass your search criteria through the link to the details page, and then again on the "back to list" link.
And (as the comment below points out), you'll of course need to then use the values from the session/querystring to run the search again and render the search results to the view, just as you did when you originally performed the search.
The easiest way is open the link content in another tab... using Clic here
Client side option:
You could load the content of the link in another container <div>... hiding the one that holds the search results and filters. Then, when user clics "Back to search...", you just show the container with the search results and filters, and hide and clean the other container.
This code is not so hard, and you don't need to go to the server again.
If you are OK with reloading the page, #Jerard Rose, in his answer, explains 2 other approachs that involves re-loading the search results, querying again the database.
Values can be transferred between pages in many ways such as: Session, QueryString, Public property, Cookie, HTTPContext.
Perhaps you are calling a 'details' action to travel to the details page. What can you do is that,
1. When you go to the details page, store your search filter value and pass it to the details page. so that when you return to the previous page you can get back/pass the values again if needed.
2. Now if you click 'back to list' button pass the values that you already have for filtering to your desired action which is responsible for the partial view.
3. Do the same thing that you did while clicking on the 'Search' button in the action.
Hope this will help
Thanks

Solution to weird Windows Phone 7 navigation problem

I have a really strange issue relating to how I handle navigation in an application, and that application now being rejected from AppHub (after being successfully approved a number of times on the same code base... grr)
currently I am capturing the first navigation of the application and routing it an "add item" page in the App.cs using the example found here
the user then adds an "item"
the user is taken to the "main" page again, but stay there are there is now 1 "item" to show in a list
the user then can view a "detail" page of this item where they can select to delete the current item. when they do that I redirect them to the "main" page again.
this navigation then fires the same thing that happened in step 1
and they are routed to an "add" page
the problem with the above process, is that if the user hits "back" on the routed page in step 5 they don't go anywhere as they are routed back to the current page (because there are no items on the page previous and this fires the app.cs routing event to take them to the add page). if I did allow for them to go back, the actual first page they would be able to go back to is 3 nav steps back, when they first added the item - as they are on the "add item" page already, this would be pointless.
The apphub store testers say that in this instance, the application should close. I really don't know how the f&*k I am meant to make this happen, as there is no "go back until close" action I can call...
thoughts?
When the user decides to "delete" the current item, you shouldn't navigate forward to the main page, leaving the deleted item in the navigation stack. You should navigate back to the main page. That way the navigation stack will be empty, and if they navigate back again, the app will close.
(The same is true at step 3, of course - when the item is added, navigate back to the main page. You don't want the "add" page as part of the navigation stack; that action has been completed.)
The single best advice I read on WP7 navigation was "if you don't have to, don't use it." I've almost stopped using it all together and just use "MainPage.xaml" for loading/unloading user controls that do this kind of stuff. I completely control the Back button as needed. It has saved me so much headache. The important thing to realize is that the Navigation pages are really just mimicking a website and it's pages - many apps do not fit that paradigm (as they are apps, not websites). So, if you don't have to use Navigation, don't use it.
So in your case, if you just managed everything on MainPage.xaml, you would use a number of If/Then statements in OnBackKeyPress and if one meets your criteria, do an e.Cancel = true; and show/load/etc. your thing. If not, let the app navigate out of itself - i.e. exit.
For tombstoning, just let the OnNavigatedTo in MainPage.xaml handle loading the right user control received from tombstoned information retrieved from Application_Activated.

Resources