Fórum

displaying portlet when link is clicked

thumbnail
John Voltaire Maximo, modificado 8 Anos atrás.

displaying portlet when link is clicked

Regular Member Postagens: 106 Data de Entrada: 19/06/15 Postagens Recentes
Hi guys,

I have a theme with links, these links should be able to call separate portlets and display them on the div I have below..
how can I achieve this?

right now I am using this code on my portal-normal.vm

<div class="col-md-12 main-content">
<div class="tab-menu">
<ul>
<li><a class="active" href="">Personal Information</a></li>
<li><a href="">Contact Details</a></li>
<li><a href="">Educational Background</a></li>
<li><a href="">Professional Background</a></li>
<li><a href="">Work Experience</a></li>
<li><a href="">Declarations</a></li>
<li><a href="">Attachments</a></li>
</ul>
</div>
<div class="main-content-body">
$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
$theme.runtime("personalInfoForms_WAR_personalInfoFormsportlet", "", $velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()

#if ($selectable)
$theme.include($content_include)
#else
$portletDisplay.recycle()

$portletDisplay.setTitle($the_title)

$theme.wrapPortlet("portlet.vm", $content_include)
#end
</div>

how do you think I can swap portlets by clicking the links?
Thanks
thumbnail
David H Nebinger, modificado 8 Anos atrás.

RE: displaying portlet when link is clicked

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
OMG what a nightmare.

A theme is not and should not be an active participant in page rendering. A theme is meant to be fairly static and extremely lightweight and fast as it is a cornerstone part of rendering every page.

You are now trying to make it into an active participant in page rendering and this will, in turn, increase your per-page processing time.

Back to your original query of "clicked link shows portlet and it's content", don't do it. First you will not be able to on the fly have the portal create a portlet, render it's html fragment and return the fragment so it can be injected in the dom. There's javascript dependencies, header/footer CSS and JS that need to be woven in during the full page rendering, on "document ready" javascript that wouldn't work at the correct times because the right elements do not exist in the DOM when the doc is ready or, for the portlet's perspective, the document is ready even though the portlet has not been placed.

So this might lead you to some crazy idea about having all of the necessary portlets on the page, but their container divs would all be "display:none" until javascript bound to the link changes it to "display:block". If you try this it will look like it will work as different links can show/hide divs this way. But pretty soon browser bugs/differences get in the way (I had one where I was toggling two divs, one above the other, a link click would hide one and show the other, but the browser didn't handle that right because it wouldn't slide the lower div up over the first one so the first div would be hidden but the space was all reserved).

Eventually you'll find that all of these options pretty much fail for one reason or another and honestly, they're just hacks. You (or your manager) have some idea that this will be really cool and all of your users will love it when, in fact, most users hate things that show and hide themselves, the movement is too distracting and besides, in the portal world, you have to process submits within the portlet for their action methods to be called so it never ends up being the cool thing you wanted and is just a bad hack of a poorly executed design concept that is more problem than it is worth.
thumbnail
John Voltaire Maximo, modificado 8 Anos atrás.

RE: displaying portlet when link is clicked

Regular Member Postagens: 106 Data de Entrada: 19/06/15 Postagens Recentes
wow I got it now,
so I think what I should do is to put the links inside a portlet,, along with the pages to call, then use renderURL to process pages and display on the div..

that should do it I think,, except when I click the link, I will redirect to another page right? but I want the form to display on the same page,, just on another div/frame.
thumbnail
John Voltaire Maximo, modificado 8 Anos atrás.

RE: displaying portlet when link is clicked

Regular Member Postagens: 106 Data de Entrada: 19/06/15 Postagens Recentes
David H. Nebinger:


Hi sir, I tried the iframe thing where I made an iframe as my target when I renderURL....
but the jsp form still displayed in another page... I want the form to display under my tabs,,,,, how can I do it?
here's the code:
<div class="col-md-12 main-content">
<div class="tab-menu">
<ul>
<li><a class="active" href="<%= personalInfo.toString() %>" target="iframe">Personal Information</a></li>
<li><a href="<%= contactDetail.toString() %>">Contact Details</a></li>
<li><a href="<%= educBackground.toString() %>">Educational Background</a></li>
<li><a href="<%= proBackground.toString() %>">Professional Background</a></li>
<li><a href="<%= workExp.toString() %>">Work Experience</a></li>
<li><a href="<%= declaration.toString() %>">Declarations</a></li>
<li><a href="<%= attachment.toString() %>">Attachments</a></li>
</ul>
</div>
<div class="main-content-body">
<iframe class="iframe"></iframe>
</div>
</div>

this doesn't work,,,, how can I make this work? or do you suggest any alternative.. haha
thumbnail
David H Nebinger, modificado 8 Anos atrás.

RE: displaying portlet when link is clicked

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
iFrames? Why in the heck would anyone want to use iFrames?
thumbnail
John Voltaire Maximo, modificado 8 Anos atrás.

RE: displaying portlet when link is clicked

Regular Member Postagens: 106 Data de Entrada: 19/06/15 Postagens Recentes
I thought of it,,,, my initial concept is to interchange the forms in a single page, they will be called one by one by links.. under my tabbedpane,,,
I didn't use tabview though because the initial design provided must be followed.. sorry
thumbnail
James Falkner, modificado 8 Anos atrás.

Thread Split

Liferay Legend Postagens: 1399 Data de Entrada: 17/09/10 Postagens Recentes
chennamma - to start a new thread unrelated to this, you should use the "Start New Thread" button instead of replying inside an existing thread. I've split your question out to a separate thread.

The new thread can be found at https://www.liferay.com/community/forums/-/message_boards/view_message/57214491.
chennamma rathode, modificado 8 Anos atrás.

RE: Thread Split

Junior Member Postagens: 45 Data de Entrada: 05/08/15 Postagens Recentes
Thank you sir......I'm new to liferay technology....