Pavel Rodionov 13 Years Ago Nice summary, but have some question. Can you clarify:"<header-portlet-javascript>http://code.jquery.com/jquery-1.4.2.min.js</header-portlet-javascript>That will add jQuery 1.4.2 into just that specific portlet."How it's possible to add jQuery per specific portltet? Is there some scope based Javascript processing in Liferay 6 that hidden somewhere? Because in earlier versions of Liferay header-portlet-javascript always meant that particular script will be included in page where portlet is rendered. So, there were never such (could it be ?) javascript per portlet functionality. Please sign in to reply. Reply as... Cancel Nate Cavanaugh Pavel Rodionov 13 Years Ago Hi Pavel,Sorry for the confusion, I will revise that line, because it will add it to the page, but it will only add it when that portlet shows up.So it's inclusion is bound to the portlet, but it's execution context is not (if that makes sense). We don't do any sort of js sandboxing, though, so I'll correct this to be more clear.Thanks for pointing this out Please sign in to reply. Reply as... Cancel
Nate Cavanaugh Pavel Rodionov 13 Years Ago Hi Pavel,Sorry for the confusion, I will revise that line, because it will add it to the page, but it will only add it when that portlet shows up.So it's inclusion is bound to the portlet, but it's execution context is not (if that makes sense). We don't do any sort of js sandboxing, though, so I'll correct this to be more clear.Thanks for pointing this out Please sign in to reply. Reply as... Cancel
Bruno Vernay 13 Years Ago Also is there a standard solution for portet concerning the use of conflicting Javascript library ??A solution that would allow the portlet to be portable ?ThanksBruno Please sign in to reply. Reply as... Cancel Nate Cavanaugh Bruno Vernay 13 Years Ago Hi Bruno,Much of it depends upon the javascript library itself.Some libraries, like mootools, prototype, etc, are by their nature conflicting, because they modify the host objects of the browser, and in order to work, they kind of require the ability to modify all of the objects on the page.If you mean conflicting and multiple versions of jQuery on a page, there is a "standard" way to include multiple versions.Basically, jQuery has a way to assign itself to a specific variable.For example:// Include jQuery 1.2.6var jQuery126 = jQuery.noConflict(true);// Include jQuery 1.4.2var jQuery142 = jQuery.noConflict(true);Now you have both versions running on the same page. While this is helpful, it's really only useful if neither of those versions include any third party plugins, which we've found is pretty infrequent.Those third party plugins will be trying to modify a version of the library that doesn't exist.You could possibly work around this by including your version of jQuery and all of its plugins together, and always followed by a js file like so:window._myjQuery14 = jQuery.noConflict(true);That might work out having them on a per portlet basis.But let me know if you had some other libraries in mind Thanks Bruno, Please sign in to reply. Reply as... Cancel Bruno Vernay Nate Cavanaugh 13 Years Ago Thanks for your quick reply !I guess that Portlets cannot do more than what HTML / Javascript is currently capable of. Maybe HTML 6 will allow for easier composition / mashup at the UI level, since it may become more prevalent: http://blog.xebia.com/2010/07/21/service-integration-at-the-presentation-layer/Regards Please sign in to reply. Reply as... Cancel krunal b soni Nate Cavanaugh 13 Years Ago Hi Nate,Yes you are quite right.By using jQuery.noConflict(true) I have implemented so many plugins in the application. But, the problem can be created by third party plugins when they are using jQuery variable in the function call like jQuery.method(). The only solution to that we have to implicitly change the jQuery variable with the name which we have defined using noConflict, say jQuery126 in your example. And that worked for me many times.Thanks Krunal Soni Please sign in to reply. Reply as... Cancel
Nate Cavanaugh Bruno Vernay 13 Years Ago Hi Bruno,Much of it depends upon the javascript library itself.Some libraries, like mootools, prototype, etc, are by their nature conflicting, because they modify the host objects of the browser, and in order to work, they kind of require the ability to modify all of the objects on the page.If you mean conflicting and multiple versions of jQuery on a page, there is a "standard" way to include multiple versions.Basically, jQuery has a way to assign itself to a specific variable.For example:// Include jQuery 1.2.6var jQuery126 = jQuery.noConflict(true);// Include jQuery 1.4.2var jQuery142 = jQuery.noConflict(true);Now you have both versions running on the same page. While this is helpful, it's really only useful if neither of those versions include any third party plugins, which we've found is pretty infrequent.Those third party plugins will be trying to modify a version of the library that doesn't exist.You could possibly work around this by including your version of jQuery and all of its plugins together, and always followed by a js file like so:window._myjQuery14 = jQuery.noConflict(true);That might work out having them on a per portlet basis.But let me know if you had some other libraries in mind Thanks Bruno, Please sign in to reply. Reply as... Cancel Bruno Vernay Nate Cavanaugh 13 Years Ago Thanks for your quick reply !I guess that Portlets cannot do more than what HTML / Javascript is currently capable of. Maybe HTML 6 will allow for easier composition / mashup at the UI level, since it may become more prevalent: http://blog.xebia.com/2010/07/21/service-integration-at-the-presentation-layer/Regards Please sign in to reply. Reply as... Cancel krunal b soni Nate Cavanaugh 13 Years Ago Hi Nate,Yes you are quite right.By using jQuery.noConflict(true) I have implemented so many plugins in the application. But, the problem can be created by third party plugins when they are using jQuery variable in the function call like jQuery.method(). The only solution to that we have to implicitly change the jQuery variable with the name which we have defined using noConflict, say jQuery126 in your example. And that worked for me many times.Thanks Krunal Soni Please sign in to reply. Reply as... Cancel
Bruno Vernay Nate Cavanaugh 13 Years Ago Thanks for your quick reply !I guess that Portlets cannot do more than what HTML / Javascript is currently capable of. Maybe HTML 6 will allow for easier composition / mashup at the UI level, since it may become more prevalent: http://blog.xebia.com/2010/07/21/service-integration-at-the-presentation-layer/Regards Please sign in to reply. Reply as... Cancel
krunal b soni Nate Cavanaugh 13 Years Ago Hi Nate,Yes you are quite right.By using jQuery.noConflict(true) I have implemented so many plugins in the application. But, the problem can be created by third party plugins when they are using jQuery variable in the function call like jQuery.method(). The only solution to that we have to implicitly change the jQuery variable with the name which we have defined using noConflict, say jQuery126 in your example. And that worked for me many times.Thanks Krunal Soni Please sign in to reply. Reply as... Cancel
M. Ahamed Maqbool 13 Years Ago Hi,I was trying to implement multiple calendars when date picker is clicked. I could easily do it by changing 'numberOfMonths' in ui.datepicker.js in liferay 5.2.3.But couldn't trace out in liferay 6.0.2. Could you help me?Thanks,Ahamed Please sign in to reply. Reply as... Cancel
Raja Nagendra Kumar 13 Years Ago If more than one portlet uses this<header-portlet-javascript>http://code.jquery.com/jquery-1.4.2.min.js</header-portlet-javascript>would inclusion of js file happen only once.. I hope this should be done once once.. else it has no meaning to say it is a global JavaScript.>That will add jQuery 1.4.2 onto the page wherever that portlet happens to be rendered.Does this mean, can other portlets on the same page be able to use this javascript, without defining <header-portlet-javascript>http://code.jquery.com/jquery-1.4.2.min.js</header-portlet-javascript>Assumption here is other portlet is always in the same page portlet A, which does define this script as headder-js..Regards,Raja Nagendra Kumar,C.T.Owww.tejaosoft.com Please sign in to reply. Reply as... Cancel
Julian Bonilla 13 Years Ago Nate - I tried using AlloyUI to load up YUI 3.3.0. I basically want to use the new DataTable component. But there seems to be a conflict when using two version of YUI3 on the same page. Any advice on getting around this issue? Thanks. Please sign in to reply. Reply as... Cancel
Mykola M 13 Years Ago Tried <header-portlet-javascript>/html/js/jquery/jquery.js</header-portlet-javascript> - the resulting link was /myportlet/html/js/jquery/jquery.js which ofcourse didn't work.Had to change it to <header-portlet-javascript>/../html/js/jquery/jquery.js</header-portlet-javascript> to make it work, but it feels wrong.Am I missing something here? Please sign in to reply. Reply as... Cancel
(You) 12 Years Ago [...] I've found answer partially in this blog http://www.liferay.com/web/nathan.cavanaugh/blog/-/blogs/using-jquery-or-any-javascript-library-in-liferay-6-0 In my case I can link necessary libraries in my... [...] Read More Please sign in to reply. Reply as... Cancel
Yerra Somesh 12 Years Ago I have a jquery file which i uploaded into js folder but the jruery code in any portal is not working. can u please help me? Please sign in to reply. Reply as... Cancel Rahul Parashar Yerra Somesh 12 Years Ago "So instead of calling YUI() in the portal, we created AUI(). By creating the "AUI" namespace, we are able to guarantee that our environment won't conflict with someone who wants to upgrade their version of YUI3 in the future"Nate, can you suggest how to upgrade to YUI 3.3. As we are facing conflicts between YUI 3.2 (which core portal internally uses) and YUI 3.3 (which we are using in our custom portlet). Please sign in to reply. Reply as... Cancel
Rahul Parashar Yerra Somesh 12 Years Ago "So instead of calling YUI() in the portal, we created AUI(). By creating the "AUI" namespace, we are able to guarantee that our environment won't conflict with someone who wants to upgrade their version of YUI3 in the future"Nate, can you suggest how to upgrade to YUI 3.3. As we are facing conflicts between YUI 3.2 (which core portal internally uses) and YUI 3.3 (which we are using in our custom portlet). Please sign in to reply. Reply as... Cancel
Kirk Stork 11 Years Ago Nate,I've been wanting to use a more up to date YUI (particularly the Model/View/Handlebars stuff), just as one other person commented a while back. I wonder if you would comment on the best ways to incorporate later versions of YUI without creating problems in AUI, as it seems that for YUI, things might be a little different than for JQuery and others.For example, could you comment on (technical parts of ) the answer posted here:http://stackoverflow.com/questions/7726261/yui-version-conflict-issue-in-portlet Please sign in to reply. Reply as... Cancel
Meenu R 10 Years Ago wan to implement datepicker using jquery? Please sign in to reply. Reply as... Cancel