Forums de discussion
[ask] Auto Refresh Portlet Liferay 6.0
Danial Mustofa Habibi, modifié il y a 10 années.
[ask] Auto Refresh Portlet Liferay 6.0
Regular Member Publications: 141 Date d'inscription: 01/11/11 Publications récentes
Hi all.. I want To create Portlet For Monitoring Something, so it need like automatically refresh portlet page every interval of time,,, how i can achieve this? I've been trying with normal method like using Javascript but its didn't work... Thanks
any help would be really appreciate
Regards
Danial
any help would be really appreciate
Regards
Danial
Zsigmond Rab, modifié il y a 10 années.
RE: [ask] Auto Refresh Portlet Liferay 6.0
Liferay Master Publications: 727 Date d'inscription: 05/01/10 Publications récentes
Hi Danial,
why doesn't the JavaScript work?
Regards,
Zsigmond
why doesn't the JavaScript work?
Regards,
Zsigmond
Danial Mustofa Habibi, modifié il y a 10 années.
RE: [ask] Auto Refresh Portlet Liferay 6.0
Regular Member Publications: 141 Date d'inscription: 01/11/11 Publications récentesZsigmond Rab:
Hi Danial,
why doesn't the JavaScript work?
Regards,
Zsigmond
Don't know but i'm using simple java script like this
var timer = null;
function auto_reload()
{
window.location = '/html/myurl/test.jsp';
}
I use them in my body tag like this
Thank's
Regards
Danial
Zsigmond Rab, modifié il y a 10 années.
RE: [ask] Auto Refresh Portlet Liferay 6.0
Liferay Master Publications: 727 Date d'inscription: 05/01/10 Publications récentes
Hi Danial,
and what's happening?
Which type of portlet are you using? I think, you should use the portlet's current url for refreshing.
Regards,
Zsigmond
and what's happening?
Which type of portlet are you using? I think, you should use the portlet's current url for refreshing.
Regards,
Zsigmond
Danial Mustofa Habibi, modifié il y a 10 années.
RE: [ask] Auto Refresh Portlet Liferay 6.0
Regular Member Publications: 141 Date d'inscription: 01/11/11 Publications récentesZsigmond Rab:
Hi Danial,
and what's happening?
Which type of portlet are you using? I think, you should use the portlet's current url for refreshing.
Regards,
Zsigmond
Nothing happen, So i'm thinking trying another way using Jquery like this
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
var load;
var portletURL = new Liferay.PortletURL();
portletURL.setParameter("jspPage", "/html/monitoringtest/data.jsp");
portletURL.setPortletId("portlet_monitoringtest_WAR_MonitoringAppportlet");
load = function () {
$('#portlet').load(portletURL.toString(), function() {
$('#portlet').append($('<p>Now is: ' + new Date() + '</p>'));
window.setTimeout(load, 5000);
});
};
load();</code></pre><br />but still no luck,, it doesn work , my portlet didn't auto refresh I got how to generate URL from <a href="https://www.liferay.com/web/eduardo.lundgren/blog/-/blogs/liferay-portleturl-in-javascript">Createing Portlet URL javascript</a><br />any idea why it doesnt work?<br /><br />I'm using MVC Portlet<br /><br />Thank's<br /><br /><br />Regards<br /><br />Danial</script>
Danial Mustofa Habibi, modifié il y a 10 années.
RE: [ask] Auto Refresh Portlet Liferay 6.0
Regular Member Publications: 141 Date d'inscription: 01/11/11 Publications récentes
Hi, Dont know previous code didnt work, but I'm managed to solve this problem using this Link
heres the code
Thank's
Regards
Danial
heres the code
script type="text/JavaScript">
<!--
function timedRefresh(timeoutPeriod) {
// setTimeout("location.reload(true);",timeoutPeriod);
// make a ajax call here. If you are using jquery then
$.post('<portlet:renderURL windowState="<%= LiferayWindowState.EXCLUSIVE.toString() %>"></portlet:renderURL>', function(data){
$("#myportlet").html(data);
})
}
timedRefresh(5000);
// -->
<div id="myportlet"></div>
Thank's
Regards
Danial