Fórumok
Automatically Update a Portlet after saved configuration
Mohd Asyraf, módosítva 11 év-val korábban
Automatically Update a Portlet after saved configuration
New Member Bejegyzések: 19 Csatlakozás dátuma: 2012.01.04. Legújabb bejegyzések
Hi,
Does anyone know how to update/ refresh a portlet automatically after saved the new configuration?
Does anyone know how to update/ refresh a portlet automatically after saved the new configuration?
Jignesh Vachhani, módosítva 11 év-val korábban
RE: Automatically Update a Portlet after saved configuration
Liferay Master Bejegyzések: 803 Csatlakozás dátuma: 2008.03.10. Legújabb bejegyzések
Can you post some of code which you have written in your *ConfigurationImpl.java ?
Might be you will have extended wrongclass.
You may have to extend DefaultConfigurationAction
Hope this will resolve your problem
Jignesh
Might be you will have extended wrongclass.
You may have to extend DefaultConfigurationAction
Hope this will resolve your problem
Jignesh
Mohd Asyraf, módosítva 11 év-val korábban
RE: Automatically Update a Portlet after saved configuration
New Member Bejegyzések: 19 Csatlakozás dátuma: 2012.01.04. Legújabb bejegyzésekpublic class ConfigurationActionImpl extends DefaultConfigurationAction {
@Override
public void processAction(PortletConfig portletConfig,
ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
System.out.println("***Inside processaction of Config****");
String url = actionRequest.getParameter("url");
int height = Integer.parseInt(actionRequest.getParameter("height"));
int maxHeight = Integer.parseInt(actionRequest.getParameter("maxHeight"));
PortletPreferences preferences = actionRequest.getPreferences();
String portletResource = ParamUtil.getString(actionRequest, "portletResource");
if (Validator.isNotNull(portletResource)) {
preferences = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource);
}
preferences.setValue("url", url);
preferences.setValue("height", Integer.toString(height));
preferences.setValue("maxHeight", Integer.toString(maxHeight));
preferences.store();
// TODO Auto-generated method stub
super.processAction(portletConfig, actionRequest, actionResponse);
}
I already expand the DefaultConfigurationAction but the portlet still not update automatically.
Jignesh Vachhani, módosítva 11 év-val korábban
RE: Automatically Update a Portlet after saved configuration
Liferay Master Bejegyzések: 803 Csatlakozás dátuma: 2008.03.10. Legújabb bejegyzések
Which version of Liferay you are using.
I checked this with Liferay 6.1CE in my local and its working properly.
I checked this with Liferay 6.1CE in my local and its working properly.
Mohd Asyraf, módosítva 11 év-val korábban
RE: Automatically Update a Portlet after saved configuration
New Member Bejegyzések: 19 Csatlakozás dátuma: 2012.01.04. Legújabb bejegyzések
I'm using Liferay 6.1CEa and it is not working on my portal.
Is there anything that i'm missing?
Is there anything that i'm missing?
David H Nebinger, módosítva 11 év-val korábban
RE: Automatically Update a Portlet after saved configuration
Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
What is not working?
Are you saying you have two browsers, and browser A is sitting there w/ the portlet that is misconfigured. Browser B is open and you configure the portlet there so that in browser B it is working right, but because you haven't done anything in browser A it is still sitting there as misconfigured? And that not until you do a page refresh will A actually show the portlet correctly?
I'm thinking you expect that when the config is updated in browser B that browser A should magically come alive and update itself to reflect the right thing.
Portlets don't work like that. As I said, unless you implement some sort of javascript push, browser A will just sit there and show the portlet as misconfigured until you refresh or submit a page.
Are you saying you have two browsers, and browser A is sitting there w/ the portlet that is misconfigured. Browser B is open and you configure the portlet there so that in browser B it is working right, but because you haven't done anything in browser A it is still sitting there as misconfigured? And that not until you do a page refresh will A actually show the portlet correctly?
I'm thinking you expect that when the config is updated in browser B that browser A should magically come alive and update itself to reflect the right thing.
Portlets don't work like that. As I said, unless you implement some sort of javascript push, browser A will just sit there and show the portlet as misconfigured until you refresh or submit a page.
Mohd Asyraf, módosítva 11 év-val korábban
RE: Automatically Update a Portlet after saved configuration
New Member Bejegyzések: 19 Csatlakozás dátuma: 2012.01.04. Legújabb bejegyzések
I'm not using two browsers. The browsers have its own cache and history.
All I want is the portlet update automatically after configured.
In other words the portlet update its content automatically.
All I want is the portlet update automatically after configured.
In other words the portlet update its content automatically.
David H Nebinger, módosítva 11 év-val korábban
RE: Automatically Update a Portlet after saved configuration
Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Nothing happens automatically, unless you code it as such.
Mohd Asyraf, módosítva 11 év-val korábban
RE: Automatically Update a Portlet after saved configuration
New Member Bejegyzések: 19 Csatlakozás dátuma: 2012.01.04. Legújabb bejegyzések
Of course i need to code it.. However, i do not know how to do that.
That's why I asked for help and need some hint on how to do that.
That's why I asked for help and need some hint on how to do that.
bo li, módosítva 11 év-val korábban
RE: Automatically Update a Portlet after saved configuration
Junior Member Bejegyzések: 38 Csatlakozás dátuma: 2011.11.14. Legújabb bejegyzések
Have you found the solution for this yet?
Mykola M, módosítva 11 év-val korábban
RE: Automatically Update a Portlet after saved configuration
New Member Bejegyzések: 4 Csatlakozás dátuma: 2011.01.20. Legújabb bejegyzések
From DefaultConfigurationAction:
SessionMessages.add(
actionRequest,
portletConfig.getPortletName() +
SessionMessages.KEY_SUFFIX_REFRESH_PORTLET,
portletResource);
Randy Parsons, módosítva 11 év-val korábban
RE: Automatically Update a Portlet after saved configuration
Junior Member Bejegyzések: 33 Csatlakozás dátuma: 2011.01.04. Legújabb bejegyzések
Thanks. This indeed does update my portlet when I hit save. Unfortunately I don't get any success message. Here is a summary of what I have found from the community and testing.
To Get a Success Message on Submit
To get a success message when you submit add the following in your ConfigurationActionImpl.java file, but it will not refresh the portlet
Imports
Code
and add the following to your configuration.jsp file
To Refresh Portlet on Submit
To refresh the portlet on the submit, use the code from Mykola M above:
Imports
Code
And use the same <aui:button> as before.
Now, if someone knows how to combine the two, could they please reply with the answer. I believe it has something to do with how the second parameter in the Session.add is used.
To Get a Success Message on Submit
To get a success message when you submit add the following in your ConfigurationActionImpl.java file, but it will not refresh the portlet
Imports
import com.liferay.portal.kernel.servlet.SessionMessages;
Code
SessionMessages.add(actionRequest, "success");
and add the following to your configuration.jsp file
<liferay-ui:success key="success" message="Configuration saved successfully!" />
...
<aui:button name="saveButton" type="submit" value="save" />
To Refresh Portlet on Submit
To refresh the portlet on the submit, use the code from Mykola M above:
Imports
import com.liferay.portal.kernel.servlet.SessionMessages;
Code
SessionMessages.add(
actionRequest,
portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET,
portletResource);
And use the same <aui:button> as before.
Now, if someone knows how to combine the two, could they please reply with the answer. I believe it has something to do with how the second parameter in the Session.add is used.
Vishal Panchal, módosítva 9 év-val korábban
RE: Automatically Update a Portlet after saved configuration
Expert Bejegyzések: 289 Csatlakozás dátuma: 2012.05.20. Legújabb bejegyzések
Dear Randy,
Thanks for all details and explanation.
I am able to combine these both.
1. Thing is below code is used to display a success message.
SessionMessages.add(actionRequest, "configuration-saved");
2. Below code is to refresh a page after we save configuration.
SessionMessages.add(actionRequest,
portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET,portletResource);
So, what I did is I wrote below code. I wrote both lines together in sequence.
Now, when I save configuration It is showing me a success message and after that I is also refreshing page.
Lines of Code to combine both success message and page refresh.
SessionMessages.add(actionRequest, "configuration-saved");
SessionMessages.add(actionRequest, portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET,portletResource);
Many Thanks,
Vishal Panchal
vslpanchal@gmail.com
Thanks for all details and explanation.
I am able to combine these both.
1. Thing is below code is used to display a success message.
SessionMessages.add(actionRequest, "configuration-saved");
2. Below code is to refresh a page after we save configuration.
SessionMessages.add(actionRequest,
portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET,portletResource);
So, what I did is I wrote below code. I wrote both lines together in sequence.
Now, when I save configuration It is showing me a success message and after that I is also refreshing page.
Lines of Code to combine both success message and page refresh.
SessionMessages.add(actionRequest, "configuration-saved");
SessionMessages.add(actionRequest, portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET,portletResource);
Many Thanks,
Vishal Panchal
vslpanchal@gmail.com
David H Nebinger, módosítva 11 év-val korábban
RE: Automatically Update a Portlet after saved configuration
Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Unless you've implemented a javascript push mechanism, the portlet will not refresh until the user refreshes their browser.