Thursday 3 November 2011

JQuery, AJAX and SharePoint 2010

I attended a great SharePoint User Group UK meeting last night – compared to the London event it was notable how many people had travelled significant distances to be there, great dedication! The first session was me (doing the first dev-focused session at this event) and the second was a panel Q & A discussion with some excellent conversations. The topic for my talk was ‘SharePoint, jQuery and AJAX - a beginner's survival guide’, and although I’ve given this talk before I want to publish the deck and code samples again as I made some updates since the last time. In fact, it’s worth calling out one of these in particular here I think:
  • If using jQuery with SharePoint 2010, ALWAYS put jQuery into ‘no conflict mode’ via jQuery.noConflict(). This is necessary because SharePoint’s internal JavaScript uses the $ symbol as a variable name in a couple of places, and this causes clashes since it’s the alias used by jQuery
The deck has information on my ‘3 core techniques’ for jQuery/AJAX apps with SharePoint, and also tips and tricks like how to get Intellisense for jQuery and the SP2010 Client Object Model, tools for debugging AJAX apps etc. The code samples cover a fairly wide range of things:
  • jQuery
    • Showing/hiding elements
    • Setting the HTML of an element
    • Cascading dropdowns
    • AJAX requests
  • Client Object Model
    • Fetching simple data
    • Implementing a “type-ahead filtering” sample against the documents in a document library
    • Creating data e.g. a new list item
    • Techniques for reducing the data going over the wire (by 95% in my example!)
  • jQuery + HTTP handlers
    • Why/how
    • Returning simple data
    • Returning complex data as JSON

No comments:

Post a Comment