留言板

LR7CEGA2 Issues rendering portlets

thumbnail
darren rose,修改在7 年前。

LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
Hi,

Custom portlets only show correctly after a customer has refreshed the page, they appear blank initially after login.

regards
thumbnail
David H Nebinger,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Liferay Legend 帖子: 14916 加入日期: 06-9-2 最近的帖子
That can be normal depending upon your implementation. For example, if the page is already rendered but your portlet needs to inject header or footer javascript, well it can't quite do that since header and footer have already been rendered.

This shouldn't be a problem in general unless if you're worried that users are seeing this as an issue updating their private pages.
thumbnail
darren rose,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
David H Nebinger:
That can be normal depending upon your implementation. For example, if the page is already rendered but your portlet needs to inject header or footer javascript, well it can't quite do that since header and footer have already been rendered.

This shouldn't be a problem in general unless if you're worried that users are seeing this as an issue updating their private pages.


these are portlets migrated from LR6.2CEGA6

and, as I said,refreshing the page, results in the portlets showing correctly.
thumbnail
Juan Gonzalez,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Liferay Legend 帖子: 3089 加入日期: 08-10-28 最近的帖子
Hi darren.

are you referring to portlets recently added to that page?
thumbnail
darren rose,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
Juan Gonzalez:
Hi darren.

are you referring to portlets recently added to that page?



Hi,

I added portlets to a page. and now login as a user, the portlets don't show correctly until I refresh the page.

The portlet using javascript to load json from rest services as soon as the portlet is shown.

regards
thumbnail
Juan Gonzalez,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Liferay Legend 帖子: 3089 加入日期: 08-10-28 最近的帖子
darren rose:
Juan Gonzalez:
Hi darren.

are you referring to portlets recently added to that page?



Hi,

I added portlets to a page. and now login as a user, the portlets don't show correctly until I refresh the page.

The portlet using javascript to load json from rest services as soon as the portlet is shown.

regards


Hi darren. With SPA, now some links are "cached" (those using RENDER_PHASE with no p_p_id), so whenever navigating there, that is being cached and next time doing it won't be refreshed by default. Fortunately this can be configured after https://issues.liferay.com/browse/LPS-65221 by some available options.

In order to change this, please read "Setting SPA Cache Configuration Options" from this page: https://dev.liferay.com/discover/portal/-/knowledge_base/7-0/system-settings

Hope it helps...
thumbnail
darren rose,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
Juan Gonzalez:
darren rose:
Juan Gonzalez:
Hi darren.

are you referring to portlets recently added to that page?



Hi,

I added portlets to a page. and now login as a user, the portlets don't show correctly until I refresh the page.

The portlet using javascript to load json from rest services as soon as the portlet is shown.

regards


Hi darren. With SPA, now some links are "cached" (those using RENDER_PHASE with no p_p_id), so whenever navigating there, that is being cached and next time doing it won't be refreshed by default. Fortunately this can be configured after https://issues.liferay.com/browse/LPS-65221 by some available options.

In order to change this, please read "Setting SPA Cache Configuration Options" from this page: https://dev.liferay.com/discover/portal/-/knowledge_base/7-0/system-settings

Hope it helps...


Yes, that resolved the issue, thanks
thumbnail
darren rose,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
actually, this resolved the issue for private pages and not public pages
thumbnail
darren rose,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
Juan Gonzalez:
darren rose:
Juan Gonzalez:
Hi darren.

are you referring to portlets recently added to that page?



Hi,

I added portlets to a page. and now login as a user, the portlets don't show correctly until I refresh the page.

The portlet using javascript to load json from rest services as soon as the portlet is shown.

regards


Hi darren. With SPA, now some links are "cached" (those using RENDER_PHASE with no p_p_id), so whenever navigating there, that is being cached and next time doing it won't be refreshed by default. Fortunately this can be configured after https://issues.liferay.com/browse/LPS-65221 by some available options.

In order to change this, please read "Setting SPA Cache Configuration Options" from this page: https://dev.liferay.com/discover/portal/-/knowledge_base/7-0/system-settings

Hope it helps...


Oddly, older portlets that I need to migrate to LR7, developed using GWT, still do not work, whether refreshing or setting the cache to 0.
thumbnail
Juan Gonzalez,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Liferay Legend 帖子: 3089 加入日期: 08-10-28 最近的帖子
darren rose:

Oddly, older portlets that I need to migrate to LR7, developed using GWT, still do not work, whether refreshing or setting the cache to 0.


Hmmm don't know right now compatibility between Senna/SPA and GWT. Did you see any javascript error?
thumbnail
Bruno Basto,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

New Member 帖子: 18 加入日期: 10-5-13 最近的帖子
Hello, Darren!

Do your portlets rely on window.onLoad events or similar? With SPA, one thing to keep in mind is that this event will only be fired once. After that, for every SPA navigation window.onLoad won't fire because the page is already loaded. If you are using JSP, we recommend developers to use the aui:script taglib. It'll concatenate, minify and print your JavaScript right before closing the <body> tag so that whatever DOM element you need to use will already be available.
thumbnail
darren rose,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
Bruno Basto:
Hello, Darren!

Do your portlets rely on window.onLoad events or similar? With SPA, one thing to keep in mind is that this event will only be fired once. After that, for every SPA navigation window.onLoad won't fire because the page is already loaded. If you are using JSP, we recommend developers to use the aui:script taglib. It'll concatenate, minify and print your JavaScript right before closing the <body> tag so that whatever DOM element you need to use will already be available.


Hi,

yes, they do,

thanks
thumbnail
Bruno Basto,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

New Member 帖子: 18 加入日期: 10-5-13 最近的帖子
Oh, ok. Can you try removing the window.onLoad?

You could do something like:

From

<script type="text/javascript">
window.onLoad = function {
 // init my portlet
}
</script>


To:

<aui:script>
// init my portlet
</aui:script>


Let me know how that works out.
thumbnail
darren rose,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
Bruno Basto:
Oh, ok. Can you try removing the window.onLoad?

You could do something like:

From

<script type="text/javascript">
window.onLoad = function {
 // init my portlet
}
</script>


To:

<aui:script>
// init my portlet
</aui:script>


Let me know how that works out.


Currently, I am doing this:

<script type="application/javascript">
(function() {
if (typeof(AUI) !== 'undefined') {
AUI().ready(function() {
startApp();
});
} else {
document.addEventListener("DOMContentLoaded", function(event) {
startApp();
});
}

})();
</script>
thumbnail
darren rose,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
as I want to test the portlets outside of Liferay
thumbnail
Bruno Basto,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

New Member 帖子: 18 加入日期: 10-5-13 最近的帖子
Ok, so I think you could do something like:


if (document.readyState == "complete" || document.readyState == "loaded") {
     // start app right away
    startApp();
}
else {
    // listen for load event to start app
    document.addEventListener("DOMContentLoaded", startApp);
}
thumbnail
darren rose,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
Bruno Basto:
Ok, so I think you could do something like:


if (document.readyState == "complete" || document.readyState == "loaded") {
     // start app right away
    startApp();
}
else {
    // listen for load event to start app
    document.addEventListener("DOMContentLoaded", startApp);
}


thanks, isn't this an equivalent, which always works on LR6.2CE?

<script type="application/javascript">
(function() {
if (typeof(AUI) !== 'undefined') {
AUI().ready(function() {
startApp();
});
} else {
document.addEventListener("DOMContentLoaded", function(event) {
startApp();
});
}

})();
</script>
thumbnail
Bruno Basto,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

New Member 帖子: 18 加入日期: 10-5-13 最近的帖子
You are right. AUI().ready will fire even when the page is already loaded.
thumbnail
darren rose,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
Bruno Basto:
You are right. AUI().ready will fire even when the page is already loaded.



which works fine in LR6, but not LR7, hence, the purpose of this intial post
thumbnail
Juan Gonzalez,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Liferay Legend 帖子: 3089 加入日期: 08-10-28 最近的帖子
Hi darren.

You said it was working fine in private pages but not public ones.

This makes me think you need to use some AUI module in your AUI method. Which AUI features you use in your startApp function?
thumbnail
darren rose,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
Hi Juan,

I don't use any aui features, I just want to know if the page has loaded, so that the javascript may then execute.

thanks
thumbnail
darren rose,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
Juan Gonzalez:
Hi darren.

You said it was working fine in private pages but not public ones.

This makes me think you need to use some AUI module in your AUI method. Which AUI features you use in your startApp function?


I only use the AUI.ready() function
thumbnail
darren rose,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
Juan Gonzalez:
darren rose:

Oddly, older portlets that I need to migrate to LR7, developed using GWT, still do not work, whether refreshing or setting the cache to 0.


Hmmm don't know right now compatibility between Senna/SPA and GWT. Did you see any javascript error?


unfortunately, I do not see any javascript errors
thumbnail
Bruno Basto,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

New Member 帖子: 18 加入日期: 10-5-13 最近的帖子
Hello Darren,

AUI().ready behavior hasn't changed. Can you confirm that, after navigation, the browser executes those lines of code?

<script type="application/javascript">

console.log('executed');

(function() {
if (typeof(AUI) !== 'undefined') {
AUI().ready(function() {
startApp();
});
} else {
document.addEventListener("DOMContentLoaded", function(event) {
startApp();
});
}
})();
</script>

About the GWT issue: How is the generated javascript from GWT included on the page?
thumbnail
darren rose,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
will do.

Actually, the GWT portlet is now working, it just has the same issue as the normal portlets, both render on private pages, but only on public pages if the page is refreshed
thumbnail
Bruno Basto,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

New Member 帖子: 18 加入日期: 10-5-13 最近的帖子
This public page issues is very odd. Is it possible to provide us with a WAR file of an example portlet so that we can try to reproduce it here?
thumbnail
darren rose,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

Regular Member 帖子: 215 加入日期: 15-4-4 最近的帖子
sure, how do I deliver this to you?

regards
thumbnail
Bruno Basto,修改在7 年前。

RE: LR7CEGA2 Issues rendering portlets

New Member 帖子: 18 加入日期: 10-5-13 最近的帖子
Can you provide a link to dropbox or google drive? If not, you can create a ticket under issues.liferay.com and attach it to it