掲示板
Javascript error: Cannot read property 'preventNotification' of undefined
12年前 に donino donino によって更新されました。
Javascript error: Cannot read property 'preventNotification' of undefined
Junior Member 投稿: 81 参加年月日: 11/07/02 最新の投稿
System: Windows & Linux
Release: Bundle Liferay 6.1GA1 / Tomcat 7
Hi,
I developped a custom 286 portlet, it works pretty well but currently i get this javascript error in the browser console, for each window where this portlet is set up:
Uncaught TypeError: Cannot read property 'preventNotification' of undefined
The error relates to the resource "<Liferay Root>/html/js/everything.jsp:3", wich i guess is dynamically built. Although the portlet works, there are few issues that may be caused by this error: for example, if i minify a portlet window and then refresh the page, the restore option won't work, i have to maximize the window to "wake up" it.
Please could someone give me clues about this javascript error?
Thanks!
Release: Bundle Liferay 6.1GA1 / Tomcat 7
Hi,
I developped a custom 286 portlet, it works pretty well but currently i get this javascript error in the browser console, for each window where this portlet is set up:
Uncaught TypeError: Cannot read property 'preventNotification' of undefined
The error relates to the resource "<Liferay Root>/html/js/everything.jsp:3", wich i guess is dynamically built. Although the portlet works, there are few issues that may be caused by this error: for example, if i minify a portlet window and then refresh the page, the restore option won't work, i have to maximize the window to "wake up" it.
Please could someone give me clues about this javascript error?
Thanks!
12年前 に António Silva によって更新されました。
RE: Javascript error: Cannot read property 'preventNotification' of undefin
New Member 投稿: 11 参加年月日: 12/04/13 最新の投稿
I have the same problem.
How I can solve this ?
How I can solve this ?
12年前 に André Bunse によって更新されました。
RE: Javascript error: Cannot read property 'preventNotification' of undefin
Junior Member 投稿: 85 参加年月日: 12/03/16 最新の投稿
Hi,
the message comes from "portlet.js" when Liferay inject html
How do you populate your portlet?
Maybe that is the reason why every new portlet from sdk adds
HTH
André
the message comes from "portlet.js" when Liferay inject html
Liferay.provide(
Portlet,
'addHTML',
function(options) {
var data = options.data;
var dataType = 'html';
<snip>
A.io.request(
url,
{
after: {
success: function() {
if [b](!data.preventNotification)[/b] {
Liferay.fire('updatedLayout');
}
}
},
data: data,
</snip>
How do you populate your portlet?
Maybe that is the reason why every new portlet from sdk adds
This is the <b>MyName</b> portlet.
HTH
André
12年前 に António Silva によって更新されました。
RE: Javascript error: Cannot read property 'preventNotification' of undefin
New Member 投稿: 11 参加年月日: 12/04/13 最新の投稿
I forgot to say that my problem have a slight difference because to me this happens with RSS Portlet that come with Liferay 6.1.
I will see what you say in RSS Portlet source code.
I will see what you say in RSS Portlet source code.
12年前 に André Bunse によって更新されました。
RE: Javascript error: Cannot read property 'preventNotification' of undefin
Junior Member 投稿: 85 参加年月日: 12/03/16 最新の投稿António Silva:
I forgot to say that my problem have a slight difference because to me this happens with RSS Portlet that come with Liferay 6.1.
I will see what you say in RSS Portlet source code.
I can reproduce it with a RSS Portlet installed.
Lowest layer of call stack is "IO._rS" from "io-base.js" (onReadyStateChange event handling),
but i can't directly see a solution to this problem.
But i think a browser who runs with production code should never caught exceptions.
Don't know if IE or other can handle this, i use Chrome and can set this in the debugger.
Are there side effects in your case?
Keep on coding
André
12年前 に António Silva によって更新されました。
RE: Javascript error: Cannot read property 'preventNotification' of undefin
New Member 投稿: 11 参加年月日: 12/04/13 最新の投稿André Bunse:
António Silva:I forgot to say that my problem have a slight difference because to me this happens with RSS Portlet that come with Liferay 6.1.
I will see what you say in RSS Portlet source code.
I can reproduce it with a RSS Portlet installed.
Lowest layer of call stack is "IO._rS" from "io-base.js" (onReadyStateChange event handling),
but i can't directly see a solution to this problem.
But i think a browser who runs with production code should never caught exceptions.
Don't know if IE or other can handle this, i use Chrome and can set this in the debugger.
Are there side effects in your case?
Keep on coding
André
If I refresh the page I cannot change RSS Portlet options anymore and when I try to open options give thatar error on Chrome Java console "Javascript error: Cannot read property 'preventNotification' of undefined".
12年前 に André Bunse によって更新されました。
RE: Javascript error: Cannot read property 'preventNotification' of undefin
Junior Member 投稿: 85 参加年月日: 12/03/16 最新の投稿António Silva:
If I refresh the page I cannot change RSS Portlet options anymore and when I try to open options give thatar error on Chrome Java console "Javascript error: Cannot read property 'preventNotification' of undefined".
Ok, i see the same behaviour. If i find a solution i will post it.
André
12年前 に António Silva によって更新されました。
RE: Javascript error: Cannot read property 'preventNotification' of undefin
New Member 投稿: 11 参加年月日: 12/04/13 最新の投稿André Bunse:
António Silva:If I refresh the page I cannot change RSS Portlet options anymore and when I try to open options give thatar error on Chrome Java console "Javascript error: Cannot read property 'preventNotification' of undefined".
Ok, i see the same behaviour. If i find a solution i will post it.
André
I solve the problem, in the file liferay-portlet.xml in \tomcat-7.0.23\webapps\ROOT\WEB-INF.
On rss portlet configuration you have this:
<portlet>
<portlet-name>39</portlet-name>
<icon>/html/icons/rss.png</icon>
<struts-path>rss</struts-path>
<configuration-action-class>com.liferay.portlet.rss.action.ConfigurationActionImpl</configuration-action-class>
<portlet-data-handler-class>com.liferay.portlet.rss.lar.RSSPortletDataHandlerImpl</portlet-data-handler-class>
<preferences-owned-by-group>true</preferences-owned-by-group>
<use-default-template>false</use-default-template>
<instanceable>true</instanceable>
<private-request-attributes>false</private-request-attributes>
<private-session-attributes>false</private-session-attributes>
[b][size=6]<render-weight>0</render-weight>[/size][/b]
<header-portlet-css>/html/portlet/rss/css/main.css</header-portlet-css>
<css-class-wrapper>portlet-rss</css-class-wrapper>
</portlet>
You need to change to:
<portlet>
<portlet-name>39</portlet-name>
<icon>/html/icons/rss.png</icon>
<struts-path>rss</struts-path>
<configuration-action-class>com.liferay.portlet.rss.action.ConfigurationActionImpl</configuration-action-class>
<portlet-data-handler-class>com.liferay.portlet.rss.lar.RSSPortletDataHandlerImpl</portlet-data-handler-class>
<preferences-owned-by-group>true</preferences-owned-by-group>
<use-default-template>false</use-default-template>
<instanceable>true</instanceable>
<private-request-attributes>false</private-request-attributes>
<private-session-attributes>false</private-session-attributes>
[b][size=6]<render-weight>50</render-weight>[/size][/b]
<header-portlet-css>/html/portlet/rss/css/main.css</header-portlet-css>
<css-class-wrapper>portlet-rss</css-class-wrapper>
</portlet>
11年前 に Thomas Berg によって更新されました。
RE: Javascript error: Cannot read property 'preventNotification' of undefin
Regular Member 投稿: 131 参加年月日: 09/09/07 最新の投稿
The above is NOT a fix even if it solves the immediate problem.
Setting the render-weight to anything higher than 0 prevents the portlet from being loaded asynchronously (in parallell). This problem (or at least similar) also exists with 6.0 releases, see LPS-21886
/ Thomas
Setting the render-weight to anything higher than 0 prevents the portlet from being loaded asynchronously (in parallell). This problem (or at least similar) also exists with 6.0 releases, see LPS-21886
/ Thomas
12年前 に Dale Larsen によって更新されました。
RE: Javascript error: Cannot read property 'preventNotification' of undefin
New Member 投稿: 1 参加年月日: 11/02/14 最新の投稿André Bunse:
António Silva:If I refresh the page I cannot change RSS Portlet options anymore and when I try to open options give thatar error on Chrome Java console "Javascript error: Cannot read property 'preventNotification' of undefined".
Ok, i see the same behaviour. If i find a solution i will post it.
André
I am seeing a similar Javascript error with the chat portlet. This actually prevents you from initiating a chat session with a desired friend. You can see Online Friends, but if you click on them to chat, the chat window does not come up (because of these prior Js errors).
In Chrome, I receive:
Uncaught TypeError: Cannot read property 'preventNotification' of undefined everything.jsp:3
In Firefox, I receive:
j is undefined
I noticed in a subsequent post Antonio mentioned changing the render-weight of the rss portlet in liferay-portlet.xml. Not sure what exactly this does and if a similar fix could apply to the chat portlet.
Any help/insight would be appreciated.