Fórumok

ADT with multiple renderURL views?

thumbnail
Andew Jardine, módosítva 8 év-val korábban

ADT with multiple renderURL views?

Liferay Legend Bejegyzések: 2416 Csatlakozás dátuma: 2010.12.22. Legújabb bejegyzések
Hey Guys,

Someone asked me a great question this morning about ADTs. Let's say I have a regular MVC portlet that is showing data. Lets say that this portlet has two views -- the view.jsp that renders summary information, and a details.jsp that renders, well, more details emoticon.

As far as I can make out I can only have one template assignment to the portlet right? So if I have an ADT template for the view.jsp piece, how can I create another for the details.jsp? or is the expectation that the portlet behave as a "single page application" where the template would contain both states?
thumbnail
Andew Jardine, módosítva 8 év-val korábban

RE: ADT with multiple renderURL views?

Liferay Legend Bejegyzések: 2416 Csatlakozás dátuma: 2010.12.22. Legújabb bejegyzések
Just to close out my own thread, I can only see two ways that are options for how to do this. If anyone else comes along this post and knows of others, hopefully they'll update it.

Option #1: Use a flag to indicate the view. With this option I can place all the views inside the one template and then toggle visibility accordingly. The nice this about this approach is that once the template is loaded I don't have to refresh teh entire page to change the visibility -- kinda like a single page application. Downside, I think, is that the template has the potential to be really big and possibly difficult to manage.

Option #2: Multiple pages. Use the same portlet but on Page A configure it to use template A and then on Page B place the same portlet again and configure it to use template B. For example, Page A could be a summary view based on an ID. if that ID is then either added to the render request, or set as a public render parameter, then pushing the "detailed view request" to Page B would allow the portlet to pick up where the other left off. A little less rich in terms of experience, but you could play with the friendly URL to give it more meaning.

If anyone else can think of options, I'd love to hear them.