4
votes

I have around 4 portlets and 2 web content on my page. Among 4 portlets, one is custom portlet. my requirement is like I need to load my custom portlet at the end. I got to know we can set this by adding following entry in liferay-portlet.xml

<render-weight>0</render-weight>

from liferay-portlet-app_6_2_0.dtd I got to know , The default value of render-weight is 1. If set to a value less than 1, the portlet is rendered in parallel. If set to a value of 1 or greater, then the portlet is rendered serially. Portlets with a greater render weight have greater priority and will be rendered before portlets with a lower render weight.

My question is, how can i set render weight of liferay portlets. Do i need to do entry in some properties file or i can achieve this using control panel.

1
AFAIK, there isnt provision to achieve through controlpanel or properties file. You can create ext plugin and provide changes in liferay-portlet-ext.xmlPankaj Kathiriya
Why you need to load the custom portlet at the end?Mark
Custom Portlet has some redundant code, so it is taking time to load the page. If I removed custom Portlet, Page load faster. I just wanted to load page faster without changing the code. I know the redundancy in the code should be removed, but changing it would be high impact. So I was finding, is there any way by which,when page load, it will load all the web contents or portlets first and at last load this specific portlet.Pranoti

1 Answers

5
votes

There is no guarantee of render order and you shouldn't change any state in the render phase - in fact no state change (e.g. public render parameter etc) is propagated, if only because you can't even change them on RenderRequest/RenderResponse.

If you rely on the assumption of a specific rendering order, you should rather change the architecture so that this assumption is no longer required. If your portlet takes some time to render, you can have it display asynchronously (e.g. like the built-in RSS portlet). If I remember correctly this is done by setting <render-weight> to 0 and <ajaxable> to true in liferay-portlet.xml