掲示板

Ajaxable

thumbnail
11年前 に Dmitry Sergeev によって更新されました。

Ajaxable

Junior Member 投稿: 34 参加年月日: 11/11/08 最新の投稿
Hi all!

Would anybody please explain me what exactly this node in liferay-portlet.xml mean?
I guess it only makes sense for standard liferay portlets? Cause I haven't seen any changes in portlet behaviour since I set it to true - portlet is refreshing te page upon render phase method is called.
I'd like to build a couple of portlets that are interacting with each other. I use public render parameters and events for this, and that's works fine The only problem is that I only can set PRP and events in Action phase, and after action phase there's always render phase and reload of the page, witch I'd like to avoid. I thought maybe <ajaxable/> could have something to do with that.
11年前 に Srikanth Konjarla によって更新されました。

RE: Ajaxable

Junior Member 投稿: 51 参加年月日: 08/10/25 最新の投稿
Here is the definition for "render-weight" and "ajaxable" from "iferay-portlet-app_6_1_0.dtd".

<!--
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.

If the ajaxable value is set to false, then render-weight is always set to 1
if it is set to a value less than 1. This means ajaxable can override
render-weight if ajaxable is set to false.
-->
<!--ELEMENT render-weight (#PCDATA)-->

<!--
The default value of ajaxable is true. If set to false, then this portlet can
never be displayed via Ajax.
-->
<!--ELEMENT ajaxable (#PCDATA)-->

Essentially, ajaxable property makes the content of the portlet is rendered after the page is rendered.
thumbnail
11年前 に Dmitry Sergeev によって更新されました。

RE: Ajaxable

Junior Member 投稿: 34 参加年月日: 11/11/08 最新の投稿
Thanks, I've already got it.
What I can't understand is what is the point of Ajax in this case?
thumbnail
11年前 に Victor Zorin によって更新されました。

RE: Ajaxable

Liferay Legend 投稿: 1228 参加年月日: 08/04/14 最新の投稿
Dim, if you have many portlets on the same page and some portlets require time to load the data, the page will only be shown when all portlets have delivered the data.

If for example, if you set render weight=0 and ajaxable=true, page will be loaded without waiting for those portlets. The content of ajaxable portlets will be delivered in the background. So in effect ajaxability allows you to run parallel processes for a single page. Making ajaxable=false simply eliminates render-weight setting.

Have not tested behavior in Liferay V6 myself yet but in V5 we had to render about 40 portlets on a single page, each of the portlets fetching and running XSLT from various backend systems. Ajaxing all of them has helped to deliver a much better user experience, plus the speed of rendering, i.e. instead of going to backend system to fetch data sequentially in a single loop portal was fetching all of them in parallel.
thumbnail
11年前 に Sagar A Vyas によって更新されました。

RE: Ajaxable

Liferay Master 投稿: 679 参加年月日: 09/04/17 最新の投稿
Dmitry Sergeev:
Thanks, I've already got it.
What I can't understand is what is the point of Ajax in this case?


Hi Dmitry,

let make it step by step.

1. Ajaxable tag is there which is says "whether your portlet will be ajaxable or not"

if you make it true. ----> Which is by default true -- That means you are allow to implement ajax call on your portlet.

if you make it false -----> Which means ---> You are not allow to implement ajax call at your portlet.

But Implementations is something which you need to do, right ?

If you want to know how to implement ajax on portlet please refer Ajax on Portlet

Please let me know if you require more information on same.

<!--
The default value of ajaxable is true. If set to false, then this portlet can
never be displayed via Ajax.
-->
<!ELEMENT ajaxable (#PCDATA)>


Thanks,
Sagar Vyas
thumbnail
11年前 に Victor Zorin によって更新されました。

RE: Ajaxable

Liferay Legend 投稿: 1228 参加年月日: 08/04/14 最新の投稿
You are not allow to implement ajax call at your portlet.

I think a small correction is required here..., you can make as many ajax calls within the portlet as you can, it works well even if ajaxable is set to false. Portlet and portal are not capable of controlling ajax calls. I suspect that ajaxable is only about initial rendering of portlet on a page, after it is rendered you can run as many background calls as you wish. Not sure why ajaxable parameter was introduced, but there must be (was) some reason. From what I know from experience, it only overrides render-weigh setting.
thumbnail
11年前 に Sagar A Vyas によって更新されました。

RE: Ajaxable

Liferay Master 投稿: 679 参加年月日: 09/04/17 最新の投稿
Hi Victor,

Thanks for correction.

I got idea from prescription only,never use it practically.

Not sure why ajaxable parameter was introduced, but there must be (was) some reason.


The reason you said is might one of them but i guess it could be more than that,practically I am finding any use of this tag, you have used it please share with us.

Thanks,
Sagar Vyas
thumbnail
11年前 に Victor Zorin によって更新されました。

RE: Ajaxable

Liferay Legend 投稿: 1228 参加年月日: 08/04/14 最新の投稿
Just out of curiosity we checked behavior of Liferay 6.1.0GA today in regards to render-weight, ajaxable and ajax calls. Nothing has changed from previous versions:
- when render-weight=1, portlet is rendered at the same time as entire page, all subsequent portlet-initiated ajax calls work;
- when render-weight=0, ajaxable=true, portlet is rendered in a background, i.e. after the entire page is rendered, all subsequent portlet-initiated ajax calls work;
- when render-weight=0, ajaxable=false, portlet is rendered as when if render-weight=1, i.e. at the same time as entire page, all subsequent portlet-initiated ajax calls work.
thumbnail
11年前 に Sagar A Vyas によって更新されました。

RE: Ajaxable

Liferay Master 投稿: 679 参加年月日: 09/04/17 最新の投稿
Victor Zorin:
Just out of curiosity we checked behavior of Liferay 6.1.0GA today in regards to render-weight, ajaxable and ajax calls. Nothing has changed from previous versions:
- when render-weight=0, ajaxable=false, portlet is rendered as when if render-weight=1, i.e. at the same time as entire page, all subsequent portlet-initiated ajax calls work.


Hi Victor,

Appreciate your descriptive R&D.

Only last point is not much clear, when render-weight=0, ajaxable=false how portlet load ?

Thanks for sharing this.

Regards,
Sagar Vyas
thumbnail
9年前 に Robin Nagpal によって更新されました。

RE: Ajaxable

Junior Member 投稿: 44 参加年月日: 14/11/18 最新の投稿
Sagar A Vyas:
Victor Zorin:


Only last point is not much clear, when render-weight=0, ajaxable=false how portlet load ?




Since you have set ajaxable to be false, your potlets cannot be not rendered with Ajax. Hence even if you set the render weight as zero, it will have no effect. However, your serveResource calls will work normally
thumbnail
9年前 に Olaf Kock によって更新されました。

RE: Ajaxable

Liferay Legend 投稿: 6396 参加年月日: 08/09/23 最新の投稿
As this old thread gets resurrected:

You'll recognize the behaviour of an ajaxable portlet when its rendering takes a while. E.g. when you add
Thread.sleep(5000);

to it's rendering phase. Without being ajaxable, the whole page will take more than these 5 seconds to render. With the portlet being ajaxable, Liferay renders the whole page immediately and takes care of the portlet's content to be completed once it's ready.

You can also see this in action in the RSS Feed portlet when you reference slow RSS feeds: Fetching the external RSS might take a while, so this loads through Ajax as well.

On portlets that render extremely quick, you'll not see any difference.