Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Philipp Kunz
Anchors (#) in urls inside a portlet
25 de Janeiro de 2012 14:14
Resposta

Philipp Kunz

Ranking: New Member

Mensagens: 9

Data de entrada: 3 de Setembro de 2011

Mensagens recentes

My portlet displays a form at the end of there is a 'calculate' button. After the form is submitted, the result of the calculation is shown. Let's further assume I don't want ajax here, not all of the time at least.

The problem is now that the whole page is reloaded when pressing the submit/calculate button. The new page is shown on top of it, meaning the horizontal scrollbar position is on top. My portlet might as well be farther down the page and not initially become visible.

My suggestion is to add what I'd refer to as anchor to the action url of the form so that the browser knowns more specifically which part of the next page to show.

as an example, instead of
http://localhost:8080/whatever
the url would be
http://localhost:8080/whatever#portletnamespace_myform

Inside the result HTML page there is a following tag:
<a name="portletnamespace_myform"></a>
This invisble anchor will then be shown on top of the browser window or the scrollbar would be at bottom most.



I already have the solution working. In fact, it was quite easy but it required to change portletfaces bridge impl.
-> Does anyone have another idea how to elegantly solve the original problem?
-> Would it be of common interest to share this tiny extension into sources?



BTW: I still don't fully understand how to build urls with JSF that have anchors (#). Whereas <f:param> tags go into the query string and there can be many of them, I haven't heared so far of anything such to define the #-part. I you ever have done this, I'd be happy to learn how. For me it does not work to append it to the view id.
Neil Griffin
RE: Anchors (#) in urls inside a portlet
11 de Abril de 2012 08:12
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 1422

Data de entrada: 26 de Julho de 2005

Mensagens recentes

This discussion is now taking place at the issue tracker. See: FACES-1166
Saskia Freiberg
RE: Anchors (#) in urls inside a portlet
23 de Agosto de 2012 09:54
Resposta

Saskia Freiberg

Ranking: New Member

Mensagens: 12

Data de entrada: 16 de Março de 2012

Mensagens recentes

Hello Philipp,

Philipp Kunz:

I already have the solution working. In fact, it was quite easy but it required to change portletfaces bridge impl.
-> Does anyone have another idea how to elegantly solve the original problem?
-> Would it be of common interest to share this tiny extension into sources?


I am interestet in that extension as i have exactly the same problem: I have a long form which ends with a "calculate"-button and do not want the user to scroll down to see the result after pressing this button.

regards,
Saskia