Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sharepoint Web Part sometimes causing left hand navigation menu to be hidden

Posted on 2013-01-07
4
Medium Priority
?
420 Views
Last Modified: 2013-01-11
I've created a web part in SharePoint 2007. I have had complaints from several users that sometimes the left hand navigation menu ("View All Site Conent", "Documents", "Lists", etc.) does not show. This behavior is not consistent. The user can load the page the first time and the panel is visible, then refresh the page and the panel disappears or vica versa. Any ideas on what might cause this behavior?
0
Comment
Question by:ZaDrizzle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Expert Comment

by:kukdai
ID: 38753353
where does it happen is it happening in all browsers or just some particular browsers.
do you have any java script in your master pages.
try it in your own machine.
clear your cache and try again and see if you can reproduce the problem
0
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 38753749
Hi,
what is this web part doing?
Perhaps the web part does not create valid html (eg missing closing tags).
If possible post the html output.
Thanks.
Rainer
0
 

Author Comment

by:ZaDrizzle
ID: 38756026
Thanks for the feedback and sorry for the slow response. It turns out that the masterpage and my webpart are both importing the same jquery library.

<script type="text/javascript" src="/_catalogs/masterpage/js/jquery/jquery-1.4.2.min.js"></script>

Open in new window


This is causing my jquery selector to fail when the page loads. I don't understand why this wouldn't throw an error everytime instead of only sometimes.
 $(function() {
 $("input[id$='usernameTxtBx']").autocomplete({
            source: function (request, response){
                $.ajax({
                type: 'POST',
                contentType: 'application/json; charset=utf-8', 
                url: '~/_layouts/UsernameAutoComplete.asmx/GetUsernames',
                data: "{ 'partialUsername': '" + request.term + "', 'maxResults': '10' }",
                dataFilter: function(data){return data;},
                success: function(data) {
                    response($.map(data.d, function (item){
                        return{
                            label: item,
                            value: item
                        }
                    }))
                }
            });
        },
        minLength: 1
        });
    });

Open in new window

I know I can just take the line to import the jquery library out of my webpart, but if the web part were to get loaded on a page that did not import the library, then the webpart would also fail. What would be an appropriate way to handle this?
0
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 2000 total points
ID: 38756193
Hi,
try this from http://buffernow.com/how-to-check-if-jquery-is-loaded/
<script type="text/javascript">
if (typeof jQuery != 'undefined') {}else{
var head = document.getElementsByTagName("head")[0];
script = document.createElement('script');
script.id = 'jQuery';
script.type = 'text/javascript';
script.src ='//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js';
head.appendChild(script);
}
</script>

Open in new window


HTH
Rainer

BTW, you might want to follow these two recommendations as well:
http://www.stephanrocks.com/2011/10/05/_spbodyonloadfunctionnames-in-sharepoint-vs-jquerys-document-ready/
0

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question