This is a migrated thread and some comments may be shown as answers.

Supporting "back" functionality

6 Answers 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sL342799
Top achievements
Rank 1
sL342799 asked on 16 Feb 2010, 02:56 AM
Hi,

I am using the MVC grid in an application where a user can sort, page  and filter the grid, and then select a record to edit (which takes them to another page). I'd like to be able to add a "back" button and take them back to the exact grid view they were at before they navigated to the new page. Is there a way to trap the filtering, sort and paging values and a way to feed them back to the grid?

Thanks!

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 16 Feb 2010, 07:28 AM
Hi sL342799,

All those values are part of the request string (Grid-page, Grid-filter and Grid-orderby). You can easily retrieve them and add them as route values. Find attached a sample application which illustrates this idea.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Matthew
Top achievements
Rank 2
answered on 05 Apr 2010, 01:40 PM
Does this work when using ajax binding? I have 'return' links to go back to my grid's position when following a link out of my grid using the ?ItemsGrid-Page and ?ItemsGrid-filter commands, but in IE, the back button obviously just takes a user back to the initialized grid.

I'm working on a solution where I use the link.href.hash and put the filter/page in the URL, but am having problems due to order of operations where the grid will start to refresh before my javascript rewrites the URL to the proper page.
0
Alex Gyoshev
Telerik team
answered on 06 Apr 2010, 09:00 AM
Hi Matthew,

Indeed, such a solution won't work with AJAX binding, as the grid does not receive any event in order to rebind to its previously selected data. The hash approach sounds great - I think you'll be able to sort out the order of operations if you prevent the first grid dataBinding event and then make your own ajaxRequest.

Best wishes,
Alex Gyoshev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Matthew
Top achievements
Rank 2
answered on 14 May 2010, 01:47 PM
How do I prevent the initial grid refresh when going back to the page? Also I realized another issue where when the user clicks the back button, in IE , no events will be fired, but the page goes back to its initial state.

With Firefox, it preserves my last page, so everything works out pretty OK there.

I think I may end up reverting to non-ajax binding just for simplicity.

My users are also looking for advanced boolean searches and I'm not sure I can give that to them with the client-side filtering available with the grid currently. I may try to poke around in the source code today and see what I can come up with.


Essentially I have 3 important fields they are searching on, and there is a textbox above each such that they can enter a term into 3 fields like:


Part Number:[                   ] Nomenclature:[                            ] Project:[                     ]

and each filter is applied with a Contains() type client-side filter, and for most searches this works out great and is simple to use, but I am now unsure of how to proceed to allow more complicated searches alongside the basic. I was considering using the built-in filtering and training the users how to use this, but I'm not sure how to get both working together nicely.


Thanks,
-Matt
0
sL342799
Top achievements
Rank 1
answered on 01 Jun 2010, 02:42 PM
Thanks Atanas. In your example, I see you are using a link external to the grid... the link I was referring to is embedded in the grid (e.g. each record has a "details" link:

columns.Bound(c => c.activityID).Format(Html.ActionLink("Details", "Details", "Activity", new { id = "{0}" }, "")).Encoded(false).Title(" ").Filterable(false).Sortable(false);

So in order to provide "back" functionality from the Details page, I'd need to pass the current route values as well in the query string above (currently only passing activityID). Is there a way to include multiple parameters into the ActionLink? Also I am using Ajax Binding for the grid navigation.

Thanks!
0
Tony Herring
Top achievements
Rank 1
answered on 19 Oct 2010, 04:06 PM
Was there an answer as to how to add the route values along with other parameters (like id) in a link?

Thanks,

-Tony
Tags
Grid
Asked by
sL342799
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Matthew
Top achievements
Rank 2
Alex Gyoshev
Telerik team
sL342799
Top achievements
Rank 1
Tony Herring
Top achievements
Rank 1
Share this question
or