Foros de discusión

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

thumbnail
Rishi Dev Gupta, modificado hace 14 años.

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

Expert Mensajes: 255 Fecha de incorporación: 23/11/08 Mensajes recientes
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 hace 14 años.

RE: Refresh only portlet content on Jquery/ajax action

Regular Member Mensajes: 179 Fecha de incorporación: 25/09/07 Mensajes recientes
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 hace 14 años.

RE: Refresh only portlet content on Jquery/ajax action

Expert Mensajes: 255 Fecha de incorporación: 23/11/08 Mensajes recientes
Thanks Christianto , that was really helpful.
Bryan Alvaro Alfaro, modificado hace 14 años.

RE: Refresh only portlet content on Jquery/ajax action

Junior Member Mensajes: 28 Fecha de incorporación: 26/11/08 Mensajes recientes
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 hace 14 años.

RE: Refresh only portlet content on Jquery/ajax action

New Member Mensajes: 4 Fecha de incorporación: 8/07/09 Mensajes recientes
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 hace 14 años.

RE: Refresh only portlet content on Jquery/ajax action

Junior Member Mensajes: 86 Fecha de incorporación: 20/03/09 Mensajes recientes
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 hace 14 años.

RE: Refresh only portlet content on Jquery/ajax action

Regular Member Mensajes: 162 Fecha de incorporación: 8/06/07 Mensajes recientes
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 hace 13 años.

RE: Refresh only portlet content on Jquery/ajax action

Regular Member Mensajes: 159 Fecha de incorporación: 6/11/09 Mensajes recientes
Hi

Check this link hope this gives an idea to refresh only your portlet.
thumbnail
Srikanth Shanigaram, modificado hace 8 años.

RE: Refresh only portlet content on Jquery/ajax action

Junior Member Mensajes: 55 Fecha de incorporación: 7/10/14 Mensajes recientes
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 hace 8 años.

RE: Refresh only portlet content on Jquery/ajax action

Liferay Master Mensajes: 735 Fecha de incorporación: 5/07/11 Mensajes recientes
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 hace 8 años.

RE: Refresh only portlet content on Jquery/ajax action

Junior Member Mensajes: 55 Fecha de incorporación: 7/10/14 Mensajes recientes
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 hace 8 años.

RE: Refresh only portlet content on Jquery/ajax action

Liferay Master Mensajes: 735 Fecha de incorporación: 5/07/11 Mensajes recientes
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 hace 8 años.

RE: Refresh only portlet content on Jquery/ajax action

Junior Member Mensajes: 55 Fecha de incorporación: 7/10/14 Mensajes recientes
Yes, But i dont have idea to do that.
thumbnail
Jan Geißler, modificado hace 8 años.

RE: Refresh only portlet content on Jquery/ajax action

Liferay Master Mensajes: 735 Fecha de incorporación: 5/07/11 Mensajes recientes
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 hace 13 años.

RE: Refresh only portlet content on Jquery/ajax action

New Member Mensaje: 1 Fecha de incorporación: 6/01/11 Mensajes recientes
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 hace 13 años.

RE: Refresh only portlet content on Jquery/ajax action

New Member Mensajes: 5 Fecha de incorporación: 5/04/10 Mensajes recientes
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 hace 12 años.

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

New Member Mensajes: 16 Fecha de incorporación: 23/03/11 Mensajes recientes
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?