This was bugging me a lot too. I wanted to keep the url intact for a combination of search form for filtering data and pagination to be used with infinite scroll. I found some helpful methods in the SS_HTTPRequest class: http://api.silverstripe.org/3.1/class-SS_HTTPRequest.html
I overrode the Link() Method in my Controller like this:
public function Link($action='') {
// Manipulate the URL So we can maintain GET Params from the Search Form
$req = Controller::curr()->getRequest(); // get the current http request object
$req->setURL(parent::Link($action)); // set the url of it to our new Link (while ignoring query params)
$url = $req->getURL(TRUE); // get the url back but with querystr intact.
return $url ;
}
Posted to: Redirect to current URL (with URL params) | Show Thread | Post Reply