Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Chris T
UI State
6 de Março de 2013 01:06
Resposta

Chris T

Ranking: New Member

Mensagens: 5

Data de entrada: 6 de Março de 2013

Mensagens recentes

Folks,

The company I work for is about to embark on creating a suite of feature rich web applications deployed within Liferay. Assuming each page represents an application, how do you maintain UI state when navigating between pages (i.e. full page refreshes)?

Obviously I can cache data on the server within the session, but what about things such as the current scroll position or any text that has been entered in any inputs? I don't want to fire off AJAX requests as a result of each user action for performance reasons. I thought cookies could be an option, but I would need to manually write onChange routines for each input field in the page which would be time consuming and error prone.

Is there a standard for doing this, or perhaps an already developed library? Am I asking too much?

I'm new to portlet development, so forgive me is this is a silly question. I've done some Googling and searching within the forum, but I've not found any concrete answers.

Thanks,

Chris
Juan Gonzalez
RE: UI State
6 de Março de 2013 01:45
Resposta

Juan Gonzalez

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 1855

Data de entrada: 28 de Outubro de 2008

Mensagens recentes

Guess you want JSF portlets, and @ViewScope beans. You can even use conversation beans, but I am not sure if this is available as JSF portlet in Liferay.
Chris T
RE: UI State
6 de Março de 2013 02:07
Resposta

Chris T

Ranking: New Member

Mensagens: 5

Data de entrada: 6 de Março de 2013

Mensagens recentes

Thanks for your quick response.

@ViewScope beans won't work for what we're going as we're navigating to a different page, then pack to the original. e.g. We have a page representing a forum and a page representing a calendar and the end user is navigating between both.

I've not used conversation beans before, but from a quick read, it doesn't sound as though it'll do what we need. The following link says it's for things like a Wizard where there is a definite start and end. We're developing multiple applications inside of a portal which will be extended in the future and there is no definite start and end points.

http://javaevangelist.blogspot.co.uk/2012/07/jsf-tip-of-day-viewscoped-and.html

Chris
Neil Griffin
RE: UI State
6 de Março de 2013 09:03
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 1995

Data de entrada: 26 de Julho de 2005

Mensagens recentes

For "current scroll position", I would recommend that you persistently store data in PortletPreferences with the user submits a form, or via Ajax. That will survive full page navigations and redirects.

For or "any text that has been entered in any inputs", that sounds to me like model data that should be saved to the database?
Chris T
RE: UI State
6 de Março de 2013 13:31
Resposta

Chris T

Ranking: New Member

Mensagens: 5

Data de entrada: 6 de Março de 2013

Mensagens recentes

We currently have a home grown 'portal' which just loads each application into an iframe and toggles whether they are visible without any full page reloads. So, if you're in application A and are currently doing some sort of data entry, switching to application B will not lose any state in application A (i.e. like a normal desktop application). All text, selected items, scroll positions of grids etc will remain as they were. This is the sort of thing I'm trying to re-create using portlets within Liferay.

I was hoping I wouldn't have to grab the state of each field/component on a page manually, but by the sounds of it I will. Current thinking is that I'll just do this onbeforeunload and store it in a cookie - I can but give it a go!

Thanks for your responses though guys.

Chris