Sena Gbeckor-Kove 15 Years Ago Hi, this all sounds very nice. I have a question however and I can't find much direct information about useing javascript in LiferayFirstly, how does one go about adding jQuery plugins in LIferay, I am trying this with v5.0.1. Do I just add the javacript in the theme directory or what?Secondly, why is it that if I try and import js directly in portal-normal.vm pages cease to render correctly. Any other pointers/gotchas you know I'm going to run into would be much appreciated.Thanks Please sign in to reply. Reply as... Cancel Nate Cavanaugh Sena Gbeckor-Kove 15 Years Ago Hi Sena,To include jQuery plugins, you would simply put them in the theme's javascript/ folder. To reference them, you can use our built in macro like so:#js("$javascript_folder/jquery_plugin_file.js")Secondly, I'm not sure why the theme wouldn't render correctly, unless the javascript is doing something odd, or there is some sort of error during the inclusion.Two questions for you:When you say "renders incorrectly" what exactly do you mean? Does the content show up, but just looks off, or does it not render at all, etc?Secondly, how are you trying to import this javascript? When you say directly, I'm not sure if you mean directly in the <head> of the document with a call to an external javascript file, or embedded somewhere in the body with the javascript inline.Either way, it shouldn't give you render issues, unless the html is invalid, or the Javascript is writing html to the document that's invalid.Thanks Sena, Please sign in to reply. Reply as... Cancel Sena Gbeckor-Kove Nate Cavanaugh 15 Years Ago Thanks Nate, I got it working eventually, I'm not sure eactly what was wrong as I had definitely tried the #js("$javascript_folder/jquery_plugin_file.js") type command earlier. Its possible that other changes I made tot he HTML my have been causing problems. Thanks for your response though.ThanksS Please sign in to reply. Reply as... Cancel
Nate Cavanaugh Sena Gbeckor-Kove 15 Years Ago Hi Sena,To include jQuery plugins, you would simply put them in the theme's javascript/ folder. To reference them, you can use our built in macro like so:#js("$javascript_folder/jquery_plugin_file.js")Secondly, I'm not sure why the theme wouldn't render correctly, unless the javascript is doing something odd, or there is some sort of error during the inclusion.Two questions for you:When you say "renders incorrectly" what exactly do you mean? Does the content show up, but just looks off, or does it not render at all, etc?Secondly, how are you trying to import this javascript? When you say directly, I'm not sure if you mean directly in the <head> of the document with a call to an external javascript file, or embedded somewhere in the body with the javascript inline.Either way, it shouldn't give you render issues, unless the html is invalid, or the Javascript is writing html to the document that's invalid.Thanks Sena, Please sign in to reply. Reply as... Cancel Sena Gbeckor-Kove Nate Cavanaugh 15 Years Ago Thanks Nate, I got it working eventually, I'm not sure eactly what was wrong as I had definitely tried the #js("$javascript_folder/jquery_plugin_file.js") type command earlier. Its possible that other changes I made tot he HTML my have been causing problems. Thanks for your response though.ThanksS Please sign in to reply. Reply as... Cancel
Sena Gbeckor-Kove Nate Cavanaugh 15 Years Ago Thanks Nate, I got it working eventually, I'm not sure eactly what was wrong as I had definitely tried the #js("$javascript_folder/jquery_plugin_file.js") type command earlier. Its possible that other changes I made tot he HTML my have been causing problems. Thanks for your response though.ThanksS Please sign in to reply. Reply as... Cancel
Jeff Goodwin 15 Years Ago Hi Nate, Great work! I am in the process of implementing Liferay 4.3.4 and would like to see an example of how to utilize JQuery tabs within a Liferay CMS VM Template. Is this possible? I saw that the tabs plugin is delivered with version 4.3.4. Thanks Please sign in to reply. Reply as... Cancel kuhajeyan gunaratnam Jeff Goodwin 15 Years Ago Thanks Nate! Please sign in to reply. Reply as... Cancel
kuhajeyan gunaratnam Jeff Goodwin 15 Years Ago Thanks Nate! Please sign in to reply. Reply as... Cancel
Manuel de la Peña 14 Years Ago Hello Nate, i've read your article but i'm not sure about it could work in my scenario. I'm developing in EXT enviroment, with Struts Portlets.You're talking about this:<a href="http://liferay.com/test/?p_p_state=exclusive" id="linkTrigger">Click me to update our text</a>.Here's how we'd do it:var linkTrigger = jQuery('#linkTrigger');var updateDiv = jQuery('#portletBox');linkTrigger.click( function(event) { updateDiv.html('<div class="loading-animation"></div>').load(this.href); return false; });But, in my case, i 've an action:var linkTrigger = jQuery('#linkTrigger');var updateDiv = jQuery('#portletBox');linkTrigger.click( function(event) { updateDiv.html('<div class="loading-animation"></div>').load("ext/app/my_action"); return false; });But it doesn't work, always get error page.What i'm doing wrong?Many thanks! Please sign in to reply. Reply as... Cancel Nate Cavanaugh Manuel de la Peña 14 Years Ago Hi Manuel,I believe you need to simply create a portlet url for your action, which you could do from Javascript like so:var actionURL = Liferay.PortletURL.createActionURL();actionURL.setParameter('ext/app/my_action');Then you could easily do: updateDiv.html('<div class="loading-animation"></div>').load(actionURL.toString());But if you're trying to load the results into a div, you probably need to create a render URL. Here is some more information here on create portlet urls in Javascript: http://www.liferay.com/web/eduardo.lundgren/blog/-/blogs/1820035Thanks for the comment Manuel. Please sign in to reply. Reply as... Cancel Manuel de la Peña Nate Cavanaugh 14 Years Ago Hello Nate, many thanks for your quick answer.I'm trying it, but i cannot get success. I'm not reaching the StrutsAction defined for "ext/app/detail". The div shows the page from a call this jQuery event (current page for the portlet)Here is my jQuery call: jQuery("[id^=view_]").click( function () { var renderURL = Liferay.PortletURL.createRenderURL(); renderURL.setParameter("<portlet:namespace/>struts_action","/ext/app/detail"); renderURL.setParameter("iddetail", jQuery(this).attr("iddetail") ); alert( "renderURL: " + renderURL.toString() ); jQuery("#detailDiv").dialog({ modal: true, resizable: true, width: 500, height: 500 }); jQuery("#detailDiv").dialog('open'); jQuery("#detailDiv").load(renderURL.toString() ); } ); Please sign in to reply. Reply as... Cancel Manuel de la Peña Manuel de la Peña 14 Years Ago Hello, Nate, have you read my post?many thanks! Please sign in to reply. Reply as... Cancel alex ace Manuel de la Peña 14 Years Ago Was your above issue ever resolved? Also would like to know how to get the results from the action into your div using the ajax example you were mentioning. Please sign in to reply. Reply as... Cancel
Nate Cavanaugh Manuel de la Peña 14 Years Ago Hi Manuel,I believe you need to simply create a portlet url for your action, which you could do from Javascript like so:var actionURL = Liferay.PortletURL.createActionURL();actionURL.setParameter('ext/app/my_action');Then you could easily do: updateDiv.html('<div class="loading-animation"></div>').load(actionURL.toString());But if you're trying to load the results into a div, you probably need to create a render URL. Here is some more information here on create portlet urls in Javascript: http://www.liferay.com/web/eduardo.lundgren/blog/-/blogs/1820035Thanks for the comment Manuel. Please sign in to reply. Reply as... Cancel Manuel de la Peña Nate Cavanaugh 14 Years Ago Hello Nate, many thanks for your quick answer.I'm trying it, but i cannot get success. I'm not reaching the StrutsAction defined for "ext/app/detail". The div shows the page from a call this jQuery event (current page for the portlet)Here is my jQuery call: jQuery("[id^=view_]").click( function () { var renderURL = Liferay.PortletURL.createRenderURL(); renderURL.setParameter("<portlet:namespace/>struts_action","/ext/app/detail"); renderURL.setParameter("iddetail", jQuery(this).attr("iddetail") ); alert( "renderURL: " + renderURL.toString() ); jQuery("#detailDiv").dialog({ modal: true, resizable: true, width: 500, height: 500 }); jQuery("#detailDiv").dialog('open'); jQuery("#detailDiv").load(renderURL.toString() ); } ); Please sign in to reply. Reply as... Cancel Manuel de la Peña Manuel de la Peña 14 Years Ago Hello, Nate, have you read my post?many thanks! Please sign in to reply. Reply as... Cancel alex ace Manuel de la Peña 14 Years Ago Was your above issue ever resolved? Also would like to know how to get the results from the action into your div using the ajax example you were mentioning. Please sign in to reply. Reply as... Cancel
Manuel de la Peña Nate Cavanaugh 14 Years Ago Hello Nate, many thanks for your quick answer.I'm trying it, but i cannot get success. I'm not reaching the StrutsAction defined for "ext/app/detail". The div shows the page from a call this jQuery event (current page for the portlet)Here is my jQuery call: jQuery("[id^=view_]").click( function () { var renderURL = Liferay.PortletURL.createRenderURL(); renderURL.setParameter("<portlet:namespace/>struts_action","/ext/app/detail"); renderURL.setParameter("iddetail", jQuery(this).attr("iddetail") ); alert( "renderURL: " + renderURL.toString() ); jQuery("#detailDiv").dialog({ modal: true, resizable: true, width: 500, height: 500 }); jQuery("#detailDiv").dialog('open'); jQuery("#detailDiv").load(renderURL.toString() ); } ); Please sign in to reply. Reply as... Cancel Manuel de la Peña Manuel de la Peña 14 Years Ago Hello, Nate, have you read my post?many thanks! Please sign in to reply. Reply as... Cancel alex ace Manuel de la Peña 14 Years Ago Was your above issue ever resolved? Also would like to know how to get the results from the action into your div using the ajax example you were mentioning. Please sign in to reply. Reply as... Cancel
Manuel de la Peña Manuel de la Peña 14 Years Ago Hello, Nate, have you read my post?many thanks! Please sign in to reply. Reply as... Cancel alex ace Manuel de la Peña 14 Years Ago Was your above issue ever resolved? Also would like to know how to get the results from the action into your div using the ajax example you were mentioning. Please sign in to reply. Reply as... Cancel
alex ace Manuel de la Peña 14 Years Ago Was your above issue ever resolved? Also would like to know how to get the results from the action into your div using the ajax example you were mentioning. Please sign in to reply. Reply as... Cancel
Muhammed Shakir 8 Years Ago sennajs is down. Any pointers ? Please sign in to reply. Reply as... Cancel