Pagination params

34 views
Skip to first unread message

Gilberto Garcia

unread,
Apr 23, 2014, 6:57:03 PM4/23/14
to lif...@googlegroups.com
Hi All,

I was wondering if there is any reason for the method
PaginatorSnippet.pageUrl to discard the original url params?
or if this is a bug.

For example, if my url is abc.com?q=something

The links in the pages will be abc.com?offset=<someNumber>

Best regards,
Giba

Vasya Novikov

unread,
Apr 24, 2014, 4:53:31 AM4/24/14
to lif...@googlegroups.com
Hi!

As far as I see, it's actually the contrary. PaginatorSnippet.pageUrl
_does_ preserve parameters. At least, that's what I see in the source of
`PaginatorSnippet.pageUrl`:

def pageUrl(offset: Long): String = {
def originalUri = S.originalRequest.map(_.uri).openOr(sys.error("No
request"))
appendParams(originalUri, List(offsetParam -> offset.toString))
}

As you see, we're doing 2 things here. First, we extract the previous
URL, which may be abc.com?q=something

After that, we're adding an additional parameter `offsetParam ->
offset.toString`.

I also remember using the PaginatorSnippet, and it worked as desired.



If you mean to say that method `HttpHelpers.appendParam` is broken in
some release or environment, then it'd be helpful if you'd provide the
details.

Gilberto Garcia

unread,
Apr 24, 2014, 6:48:57 AM4/24/14
to lif...@googlegroups.com
When I invoke S.originalRequest.map(_.uri)
_.uri comes without the params.

Anyway. I'll set a sample project

Peter Petersson

unread,
Apr 24, 2014, 4:09:10 PM4/24/14
to lif...@googlegroups.com
Reading the api doc (2.6-M1) definition on S.uri it seem that Giba is
right about the stripping.
As a side note there is a uriAndQueryString that will preserve the query.

best regards Peter Petersson

Diego Medina

unread,
Apr 24, 2014, 9:34:08 PM4/24/14
to Lift
I think it's a bug, but I can see people depending on the current behavior. How about adding page UriAndQueryString and deprecate psgeUrl and add a pageUri ?


--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

--- You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Diego Medina
Lift/Scala consultant
di...@fmpwizard.com
http://fmpwizard.telegr.am


--
Diego Medina
Lift/Scala consultant
di...@fmpwizard.com
http://fmpwizard.telegr.am

Gilberto Garcia

unread,
Apr 25, 2014, 8:29:56 AM4/25/14
to lif...@googlegroups.com
Sounds good to me.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Diego Medina
Lift/Scala consultant
di...@fmpwizard.com
http://fmpwizard.telegr.am


--
Diego Medina
Lift/Scala consultant
di...@fmpwizard.com
http://fmpwizard.telegr.am

--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages