Fórum

Refresh only portlet content on Jquery/ajax action[Resolved]

thumbnail
Rishi Dev Gupta, modificado 14 Anos atrás.

Refresh only portlet content on Jquery/ajax action[Resolved]

Expert Postagens: 255 Data de Entrada: 23/11/08 Postagens Recentes
Hi all

I am facing an issue with portlet refresh.
I have a portlet that lists the records and with each record their is a delete button at the end. So when a user clicks on delete button, the record is to be deleted (which I have done through ajax call in jQuery) and the content of portlet needs to be refreshed so that the deleted record is available no more. I don not want to refresh the page as it reloads all the portlets on it.

So anybody have faced the same situation to refresh one portlet content on click and not the whole page.

using LFR 5.2.1

Thanks & Regards
thumbnail
Christianto Sahat, modificado 14 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action

Regular Member Postagens: 179 Data de Entrada: 25/09/07 Postagens Recentes
Your portlet has to be ajaxable portlet.

Set <render-weight> to 0 and <ajaxable> true on your liferay-portlet.xml.

This will enable 'refresh' icon on your portlet. Check which javascript that's called whenever this refresh is called.

You can implement the same script for your refresh button.
thumbnail
Rishi Dev Gupta, modificado 14 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action

Expert Postagens: 255 Data de Entrada: 23/11/08 Postagens Recentes
Thanks Christianto , that was really helpful.
Bryan Alvaro Alfaro, modificado 14 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action

Junior Member Postagens: 28 Data de Entrada: 26/11/08 Postagens Recentes
Hi Rishi,
right now i'm facing the same problem, i'm trying to refresh portlet content via javascript but the refresh icon button has this href="javascript: ;" and it doesn't render anything when i call it via a document.location.replace(url).
How did you solved this issue?
THanks
Sandy K, modificado 14 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action

New Member Postagens: 4 Data de Entrada: 08/07/09 Postagens Recentes
Is Ajax is working with Latest Liferay 5.2.3?

As my add(new AjaxEventBehavior("onchange") is not working. Any advice will be of great help. Is I need to chnage any configuration?
thumbnail
Gerhard Horatschek, modificado 14 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action

Junior Member Postagens: 86 Data de Entrada: 20/03/09 Postagens Recentes
Hi,
I have a similar problem regarding automatic refreshing of a portlet. I need to have funtionality to update the whole portlet triggered by an event. Therefore I have an javascript method in a jsp. Which code I have to add for an update of the portlet? How can I implement this?
Please can you help me?
Thank you,
Regards, Gerhard
thumbnail
Tarun S. Kayasth, modificado 14 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action

Regular Member Postagens: 162 Data de Entrada: 08/06/07 Postagens Recentes
Hi Gerhard,

I am looking for same type of functionality.
Did you get any luck?

I want to submit one form in my portlet but i don't want entire portal to be refreshed. It should just refresh my portlet.

Thanks,
Tarun
thumbnail
Mohammed Azam, modificado 13 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action

Regular Member Postagens: 159 Data de Entrada: 06/11/09 Postagens Recentes
Hi

Check this link hope this gives an idea to refresh only your portlet.
thumbnail
Srikanth Shanigaram, modificado 8 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action

Junior Member Postagens: 55 Data de Entrada: 07/10/14 Postagens Recentes
Hi

I am able to refresh portlet through javascript as you said but can we pass parameters to this Liferay.portlet.refresh function.
Is it possible?

Thanks in advance.
thumbnail
Jan Geißler, modificado 8 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action

Liferay Master Postagens: 735 Data de Entrada: 05/07/11 Postagens Recentes
Just a little hint here:
The odds that somebody who posted a question 4 years ago, and is still watching an old thread and also remembers what he did back then are at nearly 0% ;)
That said:
Liferay.Portlet.refresh("#p_p_id_YOUR_PORTLET_ID")
you can pass the portlet ID as a parameter.
thumbnail
Srikanth Shanigaram, modificado 8 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action

Junior Member Postagens: 55 Data de Entrada: 07/10/14 Postagens Recentes
Thank you but i need to pass other varaibles along with portlet id to refresh with based on passed params
thumbnail
Jan Geißler, modificado 8 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action

Liferay Master Postagens: 735 Data de Entrada: 05/07/11 Postagens Recentes
So this will not work, as the method does only have one Argument. But I think you want to do the following:
Refresh the portlet, when somewhere else in the Portal an Action is performed. Is that right?
thumbnail
Srikanth Shanigaram, modificado 8 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action

Junior Member Postagens: 55 Data de Entrada: 07/10/14 Postagens Recentes
Yes, But i dont have idea to do that.
thumbnail
Jan Geißler, modificado 8 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action

Liferay Master Postagens: 735 Data de Entrada: 05/07/11 Postagens Recentes
Do some research on Inter Portlet Communication and Public Render Parameters. Those are approaches you might want to consider. The Public Render Parameter will not refresh only one portlet though.
Bostjan Stor, modificado 13 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action

New Member Mensagem: 1 Data de Entrada: 06/01/11 Postagens Recentes
Hi,

I have a question about refreshing portlets.
My portlet displays data from mysql database which is changing rapidly. So I would like to refresh my portlet every 10 seconds.

I already added lines

<render-weight>0</render-weight>
<ajaxable>true</ajaxable>

to liferay-portlet.xml. (I got a refresh button)

I already tried to refresh it with jQuery

$("#portlet_id").load(link."#portlet_id");

inside this function

setTimeout("the_function_above",10000);

but it didn't work.

I also tried to copy and modify refresh function from webapps/ROOT/js/liferay/portlet.js but it didn't work.

Is there a solution?

Thanks,

Best regards
Abel Morillo, modificado 13 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action

New Member Postagens: 5 Data de Entrada: 05/04/10 Postagens Recentes
Programaticamente se puede hacer así:


String urlRefresh = "..." // construimos la url destino del botón refresh
ThemeDisplay theme = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
theme.getPortletDisplay().setShowRefreshIcon(true);
theme.getPortletDisplay().setURLRefresh(urlRefresh);
Michele Benson, modificado 12 Anos atrás.

RE: Refresh only portlet content on Jquery/ajax action[Resolved]

New Member Postagens: 16 Data de Entrada: 23/03/11 Postagens Recentes
Rishi Dev Gupta:
Hi all

I am facing an issue with portlet refresh.
I have a portlet that lists the records and with each record their is a delete button at the end. So when a user clicks on delete button, the record is to be deleted (which I have done through ajax call in jQuery) and the content of portlet needs to be refreshed so that the deleted record is available no more. I don not want to refresh the page as it reloads all the portlets on it.

So anybody have faced the same situation to refresh one portlet content on click and not the whole page.

using LFR 5.2.1

Thanks & Regards


I've got the same problem.. but i can't resolve it adding only ajaxable and render weight...
Someone can help me?