Foren

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

thumbnail
Rishi Dev Gupta, geändert vor 14 Jahren.

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

Expert Beiträge: 255 Beitrittsdatum: 23.11.08 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Refresh only portlet content on Jquery/ajax action

Regular Member Beiträge: 179 Beitrittsdatum: 25.09.07 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Refresh only portlet content on Jquery/ajax action

Expert Beiträge: 255 Beitrittsdatum: 23.11.08 Neueste Beiträge
Thanks Christianto , that was really helpful.
Bryan Alvaro Alfaro, geändert vor 14 Jahren.

RE: Refresh only portlet content on Jquery/ajax action

Junior Member Beiträge: 28 Beitrittsdatum: 26.11.08 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Refresh only portlet content on Jquery/ajax action

New Member Beiträge: 4 Beitrittsdatum: 08.07.09 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Refresh only portlet content on Jquery/ajax action

Junior Member Beiträge: 86 Beitrittsdatum: 20.03.09 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Refresh only portlet content on Jquery/ajax action

Regular Member Beiträge: 162 Beitrittsdatum: 08.06.07 Neueste Beiträge
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, geändert vor 13 Jahren.

RE: Refresh only portlet content on Jquery/ajax action

Regular Member Beiträge: 159 Beitrittsdatum: 06.11.09 Neueste Beiträge
Hi

Check this link hope this gives an idea to refresh only your portlet.
thumbnail
Srikanth Shanigaram, geändert vor 8 Jahren.

RE: Refresh only portlet content on Jquery/ajax action

Junior Member Beiträge: 55 Beitrittsdatum: 07.10.14 Neueste Beiträge
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, geändert vor 8 Jahren.

RE: Refresh only portlet content on Jquery/ajax action

Liferay Master Beiträge: 735 Beitrittsdatum: 05.07.11 Neueste Beiträge
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, geändert vor 8 Jahren.

RE: Refresh only portlet content on Jquery/ajax action

Junior Member Beiträge: 55 Beitrittsdatum: 07.10.14 Neueste Beiträge
Thank you but i need to pass other varaibles along with portlet id to refresh with based on passed params
thumbnail
Jan Geißler, geändert vor 8 Jahren.

RE: Refresh only portlet content on Jquery/ajax action

Liferay Master Beiträge: 735 Beitrittsdatum: 05.07.11 Neueste Beiträge
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, geändert vor 8 Jahren.

RE: Refresh only portlet content on Jquery/ajax action

Junior Member Beiträge: 55 Beitrittsdatum: 07.10.14 Neueste Beiträge
Yes, But i dont have idea to do that.
thumbnail
Jan Geißler, geändert vor 8 Jahren.

RE: Refresh only portlet content on Jquery/ajax action

Liferay Master Beiträge: 735 Beitrittsdatum: 05.07.11 Neueste Beiträge
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, geändert vor 13 Jahren.

RE: Refresh only portlet content on Jquery/ajax action

New Member Beitrag: 1 Beitrittsdatum: 06.01.11 Neueste Beiträge
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, geändert vor 13 Jahren.

RE: Refresh only portlet content on Jquery/ajax action

New Member Beiträge: 5 Beitrittsdatum: 05.04.10 Neueste Beiträge
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, geändert vor 12 Jahren.

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

New Member Beiträge: 16 Beitrittsdatum: 23.03.11 Neueste Beiträge
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?