Home > Windows Tips > Windows in the Enterprise > Using jQuery to extend SharePoint
Win IT Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

WINDOWS IN THE ENTERPRISE

Using jQuery to extend SharePoint


Stephen Cummins, Contributor
09.02.2009
Rating: --- (out of 5)


Expert advice on Windows-based systems and hardware
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


While SharePoint offers a number of ways to change content structure for subsites, lists, libraries, views, columns, content types and the out-of-the-box Web parts, sometimes it's just not enough.

There are times when users or designers and developers need to make changes to the functionality and appearance of a SharePoint site in a way that is not allowed by their IT department. Since SharePoint Designer is restricted in most organizations, it is not usually an option. Another more accessible possibility is jQuery.

JQuery is a JavaScript library that lets you manipulate the user interface of SharePoint in a way that does not impact a site beyond the page. It can do this because the code is only executed in the browser and on the Web page. It has no impact on what the server serves up, which gives users a great deal of freedom beyond the out-of-the-box functionality and UI.

Adding some jQuery code to your site is simple because SharePoint already provides the means to do it -- the humble Content Editor Web Part (CEWP). While this Web part is usually used to display formatted text on a SharePoint page, it can also be used to run jQuery scripts. All you have to do is add a CEWP to your page, paste in the script, press OK or apply it. No need to compile code on the server, no complex change control procedure to get through with IT, and if it goes wrong, the worst situation is that you will have to remove the Web part from the page. The only thing you should test are browser versions, just to be sure they are compatible.

JQuery uses a library of functions hosted by Google to manipulate the data or structure (such as cascading style sheets) on your page. For that reason, most examples of jQuery you will find on the Web contain a line like this at the top:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"> <...


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Microsoft Office SharePoint Server (MOSS)  (SearchWinIT.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


;/script>

This lets the script see the functions it needs to do its job. It is possible to copy the jQuery libraries to your own server, but why not let Google host, manage and maintain them for you for free? Use jQuery for three main categories of action on your SharePoint site: change functionality, change appearance and access data.

Here are some examples of all three from the Web:

Changing functionality
In this example, it allows you to scroll through a list while keeping the column headings static. The normal functionality in SharePoint is when you load a large list and scroll down, the column headers are hidden. This script places a scrollbar in the list so the column heading stays put.

Changing appearance
This example shows how you can use jQuery to change the appearance of the Quick Launch menu. It does this by making changes to the CSS classes that SharePoint uses for the quick launch and adds extra code to them.

Accessing data
This final example is the most complex. It accesses the MOSS 2007 Search Web Service to find individual results and display them in the page. It also adds some clever code that begins the search as soon as the user starts typing the query.

With the advent of SharePoint Online, access to the back end of your SharePoint system will become even more limited. Power users and developers will have to devise more sophisticated ways to manipulate the data and interface for SharePoint. JQuery has some amazing potential as well as a large and healthy online community behind it to help it grow.


[IMAGE] Stephen Cummins, founder of www.spsfaq.com, is a SharePoint consultant and has been a SharePoint MVP (Most Valuable Professional) for the past seven years.
He lives in Kildare, Ireland, with his wife, daughter, two dogs and an ever-changing number of goldfish..


Rate this Tip
To rate tips, you must be a member of SearchWinIT.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Windows Technology Updates, Reviews and Solutions

Laptop Discounts with free coupon codes, huge savings at Notebook Review

HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts