Monday 18 February 2013

Changing portlet title dynamically at run time.

This Blog is to explain how to change the portlet title dynamically at run time. This can be done in two ways one in client side and other one in server side.

1. In server side you can do it by using render response object in your do-view method 
  exmple:=> renderResponseObject.setTitle("Give your choice title here");

2. in client side you can change it by using bellow java script function.
 example: 
document.getElemetById("portlet-id").getElementsByTagName("span")[1]. innerHTML="Give your choice title here";

add the above code into your xhtml or jsp page that is your view page, when page is loaded.means write inside onpage load function

Here in above client side code, to get portlet id in your liferay portal go to---> settings-->advance Styling, there you can find portlet id, copy and paste it in place of portlet id. copy portlet id after #symbol

No comments:

Post a Comment