Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > jquery and jquery ui conflict View modes: 
User avatar
Member
Member
asovrano-opera21 - 6/10/2013 9:27:39 AM
   
jquery and jquery ui conflict
Dear sir, I want to use a datepicker but I have a lot of problems because there is some conflict with kentico jquery ui libraries. I use this noconflict statement:
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript">var $j = $.noConflict(true);</script>

but something strange occurs and later on in html something attaches:
<link href="/favicon.ico" type="image/x-icon" rel="shortcut icon"/>
<link href="/favicon.ico" type="image/x-icon" rel="icon"/>
<link href="/CMSPages/GetResource.ashx?stylesheetfile=/CMSWebparts/Localization/languageselectiondropdown_files/langselector.css" type="text/css" rel="stylesheet"/>
<link href="/CMSPages/GetResource.ashx?stylesheetfile=/CMSScripts/jquery/jquery-ui.css" type="text/css" rel="stylesheet"/>
<link href="/CMSPages/GetResource.ashx?_webparts=980" type="text/css" rel="stylesheet"/>

that makes me loose custom ui stylesheet so the calendar is not ok
and later on, into the body:
<script src="/CMSScripts/jquery/jquery-core.js" type="text/javascript"></script>
<script src="/CMSScripts/jquery/jquery-ui.js" type="text/javascript"></script>
<script src="/CMSScripts/DragAndDrop/dragiframe.js" type="text/javascript"></script><input type="hidden" name="lng" id="lng" value="it-IT" />

so "he" tries to use the old version of jquery ui where I had to comment out Datepicker !!!
I cannot really find a solution. I seems not to work correctly when user is logged on
Is there someone who can help me in this topic ?
Thank you very very much for your help
Andrea

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 6/10/2013 12:10:35 PM
   
RE:jquery and jquery ui conflict
Are you seeing this when testing AND still being logged into the CMSDesk or CMSSitemanager? If so, log out of the CMSDesk or Site Manager and see if your problem persists. You can also put this in your master page layout if you want to include the jQuery UI and NOT the jQuery UI CSS.
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
CMS.GlobalHelper.ScriptHelper.RegisterJQueryUI(this.Page, false);
}
</script>
I add the jQuery UI CSS in the master page manually as I want it to be loaded prior to any default App_Theme stylesheet.

User avatar
Member
Member
asovrano-opera21 - 6/12/2013 5:02:02 AM
   
RE:jquery and jquery ui conflict
Thank you very much FroggEye, but I have not exactly understood where to paste the script ... I pasted into masterpage header section but it does not work, the stylesheet is loaded as before.
Kind Regards

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 6/12/2013 7:01:19 AM
   
RE:jquery and jquery ui conflict
asovrano-opera21 wrote: ...I have not exactly understood where to paste the script ... I pasted into masterpage header section but it does not work...

Andrea, as Sandro mentions in his post, (the first link) will describe that. But for simplicity sake, if you are in your sites master page, select the Master Page in the content tree, then select the Master Page tab in editing mode. Then select Edit Layout and paste the code at the top of the layout. This will register the jQuery on every page that loads.

User avatar
Member
Member
kentico_sandroj - 6/10/2013 8:39:46 PM
   
RE:jquery and jquery ui conflict
Hi Andrea,

If FroggEyes suggestion does not help, please try the following workarounds:

Native Library
jQuery Quotation
Default & Linked Conflict

Please let us know if you have any additional questions.

Regards,
Sandro

User avatar
Member
Member
asovrano-opera21 - 6/13/2013 5:53:40 AM
   
RE:jquery and jquery ui conflict
Dear Sandro, excuse me I liked very much FroggEye's solution
but I cannot see it work ...
I wrote the Page_Load into masterpage layout:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e) {
CMS.GlobalHelper.ScriptHelper.RegisterJQueryUI(this.Page, false);
}
</script>

but I still see loading the ui.css in the page source:
...
<link href="/CMSPages/GetResource.ashx?stylesheetfile=/CMSScripts/jquery/jquery-ui.css" type="text/css" rel="stylesheet"/>
<link href="/CMSPages/GetResource.ashx?_webparts=980" type="text/css" rel="stylesheet"/>
</head>

Can you help me in this topic ? Maybe I wrote the method in a wrong place (I even tried at the top of the layout, before "<!--header-->") ?
Or do I need some other missing configuration ?
Thank you very much and Kind Regards
Andrea

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 6/13/2013 8:46:26 AM
   
RE:jquery and jquery ui conflict
As I mentioned before, if you are logged into CMSDesk or CMSSIteManager, log out and clear the cache or restart the appliation or IIS. Also know some of the web parts included with Kentico also use the jQuery UI so it could very well be that you are using one of those and it is being added back in again.