Hi,
I'm facing a strange issue, in my WCM SharePoint website I use RadMenu instead of standard menu provided by Microsoft. Everything is great except that the menu doesn't highlight the good selected link in the menu. I think it's because I use relative links instead of absolute links (but as my website is accessed with different URLs I can't use absolute links).
So, I decided that I will use clientside scripting to get the menu highlight the good items. This is the code I (thought I could) use :
This code doesn't work, so I tried to debug with the old good method and kept just this part :
And this doesn't work either ! If I replace the $find with a $get the latter code works but not the first one (obviously because $get doesn't return a component). As you can see I'm a bit stuck... :D
Does anyone has a Idea about why the $find method doesn't work in that case ?
Thank for any help !
Edgar
I'm facing a strange issue, in my WCM SharePoint website I use RadMenu instead of standard menu provided by Microsoft. Everything is great except that the menu doesn't highlight the good selected link in the menu. I think it's because I use relative links instead of absolute links (but as my website is accessed with different URLs I can't use absolute links).
So, I decided that I will use clientside scripting to get the menu highlight the good items. This is the code I (thought I could) use :
_spOnLoadBodyFunctionsNames.push("HighlightMenuItem"); //because SharePoint needs this :p | |
function HighLightMenuItem() { | |
var menu = $find("ctl00_RadMenuTop"); // Can't use <%=RadMenuTop.ClientID%> as this is not allowed in SharePoint masterpage | |
if(menu != null) { | |
var menuItemFocused = menu.get_focusedItem(); // to get the default page that is always focused in my case; | |
if(menuItemFocused != null) { | |
menuItemFocused.blur(); | |
} | |
var menuItemSelected = menu.findItemByAbosluteUrl(window.location.href); | |
if(menuItemSelected != null) { | |
menuItemSeleted.set_focused(); | |
} | |
} | |
} |
This code doesn't work, so I tried to debug with the old good method and kept just this part :
_spOnLoadBodyFunctionsNames.push("HighlightMenuItem"); | |
function HighLightMenuItem() { | |
var menu = $find("ctl00_RadMenuTop"); | |
if(menu != null) { | |
alert("Menu found"); | |
} | |
} |
And this doesn't work either ! If I replace the $find with a $get the latter code works but not the first one (obviously because $get doesn't return a component). As you can see I'm a bit stuck... :D
Does anyone has a Idea about why the $find method doesn't work in that case ?
Thank for any help !
Edgar