简体   繁体   English

在JavaScript中更改Liferay Portlet标题

[英]Change Liferay Portlet Title in javascript

Does it possible to change liferay portlet title using javascript? 是否可以使用javascript更改liferay portlet标题? For example I have a couple of divs, one of them is shown, other are hidden. 例如,我有几个div,其中一个已显示,另一个已隐藏。 I press the button and different div is going to be shown. 我按下按钮,将显示不同的div。 Portlet title must be name of that div. Portlet标题必须是该div的名称。

There is portletTitleEdit function in util.js, but seems it's not the function I need, because it tries to save the portletTitle via ajax. util.js中有portletTitleEdit函数,但似乎不是我需要的函数,因为它试图通过ajax保存portletTitle。 I need just to substitute the title. 我只需要替换标题即可。

You could add some custom javascript as jQuery is available something like 您可以添加一些自定义javascript,因为jQuery可用,例如

$('#idOfPortlet').find('.portlet-title').html('new title'); $('#idOfPortlet')。find('。portlet-title')。html('new title'); would suffice. 就足够了。 This would narrow this down to a particular portlet you could include this using the liferay-portlet.xml file in your portlet 这会将范围缩小到特定的portlet,您可以在portlet中使用liferay-portlet.xml文件将其包括在内

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM