Fórumok

Ajaxable

thumbnail
Dmitry Sergeev, módosítva 11 év-val korábban

Ajaxable

Junior Member Bejegyzések: 34 Csatlakozás dátuma: 2011.11.08. Legújabb bejegyzések
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.
Srikanth Konjarla, módosítva 11 év-val korábban

RE: Ajaxable

Junior Member Bejegyzések: 51 Csatlakozás dátuma: 2008.10.25. Legújabb bejegyzések
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
Dmitry Sergeev, módosítva 11 év-val korábban

RE: Ajaxable

Junior Member Bejegyzések: 34 Csatlakozás dátuma: 2011.11.08. Legújabb bejegyzések
Thanks, I've already got it.
What I can't understand is what is the point of Ajax in this case?
thumbnail
Victor Zorin, módosítva 11 év-val korábban

RE: Ajaxable

Liferay Legend Bejegyzések: 1228 Csatlakozás dátuma: 2008.04.14. Legújabb bejegyzések
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
Sagar A Vyas, módosítva 11 év-val korábban

RE: Ajaxable

Liferay Master Bejegyzések: 679 Csatlakozás dátuma: 2009.04.17. Legújabb bejegyzések
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
Victor Zorin, módosítva 11 év-val korábban

RE: Ajaxable

Liferay Legend Bejegyzések: 1228 Csatlakozás dátuma: 2008.04.14. Legújabb bejegyzések
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
Sagar A Vyas, módosítva 11 év-val korábban

RE: Ajaxable

Liferay Master Bejegyzések: 679 Csatlakozás dátuma: 2009.04.17. Legújabb bejegyzések
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
Victor Zorin, módosítva 11 év-val korábban

RE: Ajaxable

Liferay Legend Bejegyzések: 1228 Csatlakozás dátuma: 2008.04.14. Legújabb bejegyzések
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
Sagar A Vyas, módosítva 11 év-val korábban

RE: Ajaxable

Liferay Master Bejegyzések: 679 Csatlakozás dátuma: 2009.04.17. Legújabb bejegyzések
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
Robin Nagpal, módosítva 9 év-val korábban

RE: Ajaxable

Junior Member Bejegyzések: 44 Csatlakozás dátuma: 2014.11.18. Legújabb bejegyzések
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
Olaf Kock, módosítva 9 év-val korábban

RE: Ajaxable

Liferay Legend Bejegyzések: 6403 Csatlakozás dátuma: 2008.09.23. Legújabb bejegyzések
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.