SlideShare a Scribd company logo
jQuery – What I Wish I Would Have Known a Year Ago… Mark Rackley – Solutions ArchitectEmail: mrackley@gmail.comBlog: http://www.sharepointhillbilly.comTwitter: http://www.twitter.com/mrackley
AgendajQuery OverviewjQuery & SharePoint – What’s the Point?Deployment, Maintenance, UpgradesSPServicesDevelopment & DebuggingExamples2
What is jQuery?JavaScript utility library - no cross browser issues if you are carefulQuickly write interactive and USABLE applicationsYou don’t have to deploy assemblies (perfect for tightly controlled environments)
What Skills do I need?JavaScript (duh)CSSA development background helps!It IS codeUses development constructsIf you can’t write code, your ability to do magic will be limited to what you can copy/pasteCAML, CAML, CAML… Sorry…Ability to think outside the boxUse all the pieces together
SharePoint & jQuery? Why?Resolves many SharePoint complaints without having to crack open Visual Studio“It looks like SharePoint” becomes “That’s SharePoint?”“SharePoint can’t do that out of the box” becomes “Sure, no problem”“That will take 3 weeks???” becomes “2 days? Awesome! I love you… here, please accept this bonus for being such a wonderful developer”
jQuery makes your SharePoint applications USABLE
Common MythsIt’s not secureBusted… It uses SharePoint security. All scripts run with privleges of current userIt doesn’t perform wellPlausible… It performs very well if you use it correctly in the right situationsI can’t elevate privileges if I need toConfirmed…
What about…I can’t interact with SharePoint Lists and LibrariesBusted… You can call Web Services with JavaScript (SPServices is a wonderful jQuery library that wraps SharePoints Web Service calls)It has no real use in my environment because of “x”Busted… Quickly prototype and tweak web parts before writing in Visual Studio. In fact, in some environments it is the only development option.
Yeah But… It’s not deployableCreate central script document library for jQuery scriptsUpload new versions as neededTurn on versioning and store multiple versionsUse metadata to keep track of script informationStore on file systemDeploy with solution packageIncreased performance of loading from file system
Okay… but… It’s not maintainableScript PlacementDon’t put your script source in the CEWPDon’t hardcode scripts in your MasterPagesAgain… deploy scripts to central script document library or to file system with solution packageIf stored in doc lib, turn on versioning to easily roll-back if needed.
Moving Between Environments and Upgrading to 2010It just works… (woo hoo)Uses list names and not GUIDs so no issues moving from dev to prodFor the most part works identical in 2007 and 2010 (I’m sure there’s the occasional issue but I’ve never run into it).Might want to tweak in 2010 to take advantage of 2010 features (ribbin, modal pop-ups)
Okay then…jQuery must be the SharePoint Silver BulletBusted…It does “expose” business logic to user if they dig aroundIt executes on the client side and can perform slow if manipulating larges amounts of dataBe extra careful for external facing applicationsYou can’t do EVERYTHING with jQuerylike…Timer JobsWorkflows (although it can eliminate the need for some)Event HandlersElevate PrivligesEasily interact with all business systems
jQuery is another tool for the SharePoint Developer’s toolkitUnderstand the limitationsUse it wisely
Development BasicsjQuery methods are executed using jQuery() or $()You don’t have to use $(document).ready() Use $() directly$(‘#elementID’) to interact with any element$(‘#elementID’).val() gets values of inputs$(‘#elementID’).val([value]) sets the values of inputs$(‘#elementID’).html() gets the raw html within an element (great for divs, spans, tables, table cells, etc.)$(‘#elementID’).html(“<html text>”) to set raw html$(‘#elementID’).hide() and $(‘#elementID’).show()
Development Basicsvardivs = $(“div”);Returns all divs in the document$(‘#element’).addClass(“className”);$(‘#element’).removeClass(“className”);$(‘#element’).attr(“attributeName”);$(‘#element’).attr(“attributeName”,”attributeValue”);GET O’REILLY’S JQUERY POCKET REFERENCEhttp://oreilly.com/catalog/0636920016182
More Dev BasicsEach loops$('table[class="myTable"]').each(		function () {			$('#' + this.id).hide();		});CDATA is a life saverWrap values in CDATA tags:"<![CDATA[" + data + "]]>"
SPServicesjQuery library to execute SharePoint’s Web ServicesGet List ItemsAdd/Update List ItemsCreate lists, content types, site columns, etc.Create document library foldersCreate cascading drop down lists
Get user groups and permissions
Potentially call ANY SharePoint Web ServiceSPServicesWorks identical in SharePoint 2007 and SharePoint 2010Runs with permissions of current userCommunicate across sites
SPServicesGetListItems
SPServicesUpdateListItems
SPServices - FYIUse internal field names Returned values have “ows_” in front of field names$(this).attr("ows_Title");Lookup & People fieldsValue returned as “ID;#Value”  (1;#Field Value)Check for new item ID on item add to make sure item added correctlyvarnewID = $(xData.responseXML).find("[nodeName=z:row]").attr("ows_ID");
Development TipsDevelop for performanceLimit rows returned using CAMLAvoid screen scraping (Use SPServices)Don’t call web services until the data is needed.Use those ID’s to your advantage<td id=‘ListName-4’>Attributes are awesome<input type="text" title="list title 4" id="4">$('#4').attr("title");
Writing jQueryPick whatever editor makes you happy…Visual StudioI don’t use it, so can’t speak to itAptana (actual JavaScript IDE)Gives you some intellisenseNotePad++Good bracket matching which tends to bite you in the butt
Debugging… ugh.. It ain’t prettyAlerts.. Alerts.. Alerts.. Alerts…Developer ToolsSet breakpointsEvaluate expressions and variables inline (like REAL debugging!)Firebug for Firefox Considered to be best of the free tools out thereIE Developer Tools Comes installed on IE 8+
Debugging… Common ErrorsUsually it means your library didn’t get loadedObject ExpectedObject doesn’t support methodMake sure you don’t load scripts more than onceNull Object referenceCheck your bracesMake sure you end lines with “;”Check for missing quotesWhen all else fails, delete your script and rebuild it slowly in chunks, testing as you go.
DEMOS
How to get it…jQueryhttp://jquery.com/SPServiceshttp://spservices.codeplex.comSuper Awesome 3rd party libraries that integrate wellModal dialogs - http://www.ericmmartin.com/projects/simplemodal/Calendar - http://arshaw.com/fullcalendar/Charts - http://g.raphaeljs.com/
More jQuery ResourcesjQuery Pocket Referencehttp://oreilly.com/catalog/0636920016182CSS Pocket Referncehttp://oreilly.com/catalog/9780596515058/

More Related Content

PPTX
SharePoint Saturday St. Louis - SharePoint & jQuery
PPTX
SharePoint Saturday NYC - SharePoint and jQuery, what I wish I would have kno...
PPT
Android | Busy Java Developers Guide to Android: UI | Ted Neward
PPT
jQuery introduction
PDF
Angular or Backbone: Go Mobile!
PDF
Javascript projects Course
PPTX
SharePoint Cincy 2012 - jQuery essentials
PDF
Efficient Rails Test-Driven Development - Week 6
SharePoint Saturday St. Louis - SharePoint & jQuery
SharePoint Saturday NYC - SharePoint and jQuery, what I wish I would have kno...
Android | Busy Java Developers Guide to Android: UI | Ted Neward
jQuery introduction
Angular or Backbone: Go Mobile!
Javascript projects Course
SharePoint Cincy 2012 - jQuery essentials
Efficient Rails Test-Driven Development - Week 6

What's hot (20)

PDF
Learn about Eclipse e4 from Lars Vogel at SF-JUG
PDF
JavaScript
PPT
Building Smart Workflows - Dan Diebolt
PPTX
More object oriented development with Page Type Builder
PDF
Handlebars and Require.js
PDF
Styling Components with JavaScript: MelbCSS Edition
PDF
Android L01 - Warm Up
PPTX
Lesson 202 02 oct13-1800-ay
PDF
Styling components with JavaScript
PPTX
Scala Italy 2015 - Hands On ScalaJS
PPS
Advisor Jumpstart: JavaScript
PPTX
MVC Frameworks for building PHP Web Applications
PPT
J Query(04 12 2008) Foiaz
PPTX
JavaScript DOM - Dynamic interactive Code
PPTX
Monster JavaScript Course - 50+ projects and applications
PPTX
J Query The Write Less Do More Javascript Library
PDF
Metaprogramming JavaScript
PPTX
Google Apps Script for Beginners- Amazing Things with Code
PPTX
Getting Started with jQuery
PDF
Angular - Chapter 4 - Data and Event Handling
Learn about Eclipse e4 from Lars Vogel at SF-JUG
JavaScript
Building Smart Workflows - Dan Diebolt
More object oriented development with Page Type Builder
Handlebars and Require.js
Styling Components with JavaScript: MelbCSS Edition
Android L01 - Warm Up
Lesson 202 02 oct13-1800-ay
Styling components with JavaScript
Scala Italy 2015 - Hands On ScalaJS
Advisor Jumpstart: JavaScript
MVC Frameworks for building PHP Web Applications
J Query(04 12 2008) Foiaz
JavaScript DOM - Dynamic interactive Code
Monster JavaScript Course - 50+ projects and applications
J Query The Write Less Do More Javascript Library
Metaprogramming JavaScript
Google Apps Script for Beginners- Amazing Things with Code
Getting Started with jQuery
Angular - Chapter 4 - Data and Event Handling
Ad

Similar to #SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago.. (20)

PPTX
Spsemea j query
PPTX
SPSDenver - SharePoint & jQuery - What I wish I would have known
PPTX
SharePoint and jQuery Essentials
PPTX
SPSTC - SharePoint & jQuery Essentials
PPTX
SPSNH 2014 - The SharePoint & jQueryGuide
PPTX
The SharePoint & jQuery Guide
PPTX
The SharePoint and jQuery Guide by Mark Rackley - SPTechCon
PPTX
SharePoint & jQuery Guide - SPSNashville 2014
PPTX
SPTechCon DevDays - SharePoint & jQuery
PPTX
The SharePoint & jQuery Guide - Updated 1/14/14
PPTX
SPTechCon Boston 2015 - Utilizing jQuery in SharePoint
PPTX
SPTechCon 2014 How to develop and debug client side code in SharePoint
PPTX
Utilizing jQuery in SharePoint: Get More Done Faster
PPTX
(Updated) SharePoint & jQuery Guide
PPTX
SPTechCon - Share point and jquery essentials
PPTX
SharePoint & jQuery Guide - SPSTC 5/18/2013
PPTX
SEF2013 - A jQuery Primer for SharePoint
PPTX
Introduction to using jQuery with SharePoint
PDF
No Feature Solutions with SharePoint
PDF
Pro Sharepoint With Jquery New Phill Duffy
Spsemea j query
SPSDenver - SharePoint & jQuery - What I wish I would have known
SharePoint and jQuery Essentials
SPSTC - SharePoint & jQuery Essentials
SPSNH 2014 - The SharePoint & jQueryGuide
The SharePoint & jQuery Guide
The SharePoint and jQuery Guide by Mark Rackley - SPTechCon
SharePoint & jQuery Guide - SPSNashville 2014
SPTechCon DevDays - SharePoint & jQuery
The SharePoint & jQuery Guide - Updated 1/14/14
SPTechCon Boston 2015 - Utilizing jQuery in SharePoint
SPTechCon 2014 How to develop and debug client side code in SharePoint
Utilizing jQuery in SharePoint: Get More Done Faster
(Updated) SharePoint & jQuery Guide
SPTechCon - Share point and jquery essentials
SharePoint & jQuery Guide - SPSTC 5/18/2013
SEF2013 - A jQuery Primer for SharePoint
Introduction to using jQuery with SharePoint
No Feature Solutions with SharePoint
Pro Sharepoint With Jquery New Phill Duffy
Ad

More from Mark Rackley (18)

PPTX
Column Formatter in SharePoint Online
PPTX
SharePoint Conference North America - Converting your JavaScript to SPFX
PPTX
A Power User's Introduction to jQuery Awesomeness in SharePoint
PPTX
Citizen Developers Intro to jQuery Customizations in SharePoint
PPTX
A Power User's intro to jQuery awesomeness in SharePoint
PPTX
A Power User's Intro to jQuery Awesomeness in SharePoint
PPTX
#SPSTC Maximizing the SharePoint User Experience with Free 3rd Party jQuery L...
PPTX
Introduction to StratusForms #SayNoToInfoPath
PPTX
SPTechCon Boston 2015 - Overcoming SharePoint Limitations
PPTX
TulsaTechFest - Maximize SharePoint UX with free jQuery libraries
PPTX
SPTechCon Dev Days - Third Party jQuery Libraries
PPTX
Using jQuery to Maximize Form Usability
PPTX
SharePoint REST vs CSOM
PPTX
Introduction to Client Side Dev in SharePoint Workshop
PDF
NOW I Get it!! What SharePoint IS and why I need it
PPTX
What is SharePoint Development??
PPTX
Wrapping your head around the SharePoint Beast (For the rest of us)
PPTX
What IS SharePoint Development?
Column Formatter in SharePoint Online
SharePoint Conference North America - Converting your JavaScript to SPFX
A Power User's Introduction to jQuery Awesomeness in SharePoint
Citizen Developers Intro to jQuery Customizations in SharePoint
A Power User's intro to jQuery awesomeness in SharePoint
A Power User's Intro to jQuery Awesomeness in SharePoint
#SPSTC Maximizing the SharePoint User Experience with Free 3rd Party jQuery L...
Introduction to StratusForms #SayNoToInfoPath
SPTechCon Boston 2015 - Overcoming SharePoint Limitations
TulsaTechFest - Maximize SharePoint UX with free jQuery libraries
SPTechCon Dev Days - Third Party jQuery Libraries
Using jQuery to Maximize Form Usability
SharePoint REST vs CSOM
Introduction to Client Side Dev in SharePoint Workshop
NOW I Get it!! What SharePoint IS and why I need it
What is SharePoint Development??
Wrapping your head around the SharePoint Beast (For the rest of us)
What IS SharePoint Development?

Recently uploaded (20)

PPTX
1. Introduction to Computer Programming.pptx
PDF
Mushroom cultivation and it's methods.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Approach and Philosophy of On baking technology
PDF
Getting Started with Data Integration: FME Form 101
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
August Patch Tuesday
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PPTX
Programs and apps: productivity, graphics, security and other tools
1. Introduction to Computer Programming.pptx
Mushroom cultivation and it's methods.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
A comparative study of natural language inference in Swahili using monolingua...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Network Security Unit 5.pdf for BCA BBA.
A comparative analysis of optical character recognition models for extracting...
OMC Textile Division Presentation 2021.pptx
Spectral efficient network and resource selection model in 5G networks
Group 1 Presentation -Planning and Decision Making .pptx
Approach and Philosophy of On baking technology
Getting Started with Data Integration: FME Form 101
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Assigned Numbers - 2025 - Bluetooth® Document
August Patch Tuesday
Univ-Connecticut-ChatGPT-Presentaion.pdf
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Programs and apps: productivity, graphics, security and other tools

#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..

  • 1. jQuery – What I Wish I Would Have Known a Year Ago… Mark Rackley – Solutions ArchitectEmail: mrackley@gmail.comBlog: http://www.sharepointhillbilly.comTwitter: http://www.twitter.com/mrackley
  • 2. AgendajQuery OverviewjQuery & SharePoint – What’s the Point?Deployment, Maintenance, UpgradesSPServicesDevelopment & DebuggingExamples2
  • 3. What is jQuery?JavaScript utility library - no cross browser issues if you are carefulQuickly write interactive and USABLE applicationsYou don’t have to deploy assemblies (perfect for tightly controlled environments)
  • 4. What Skills do I need?JavaScript (duh)CSSA development background helps!It IS codeUses development constructsIf you can’t write code, your ability to do magic will be limited to what you can copy/pasteCAML, CAML, CAML… Sorry…Ability to think outside the boxUse all the pieces together
  • 5. SharePoint & jQuery? Why?Resolves many SharePoint complaints without having to crack open Visual Studio“It looks like SharePoint” becomes “That’s SharePoint?”“SharePoint can’t do that out of the box” becomes “Sure, no problem”“That will take 3 weeks???” becomes “2 days? Awesome! I love you… here, please accept this bonus for being such a wonderful developer”
  • 6. jQuery makes your SharePoint applications USABLE
  • 7. Common MythsIt’s not secureBusted… It uses SharePoint security. All scripts run with privleges of current userIt doesn’t perform wellPlausible… It performs very well if you use it correctly in the right situationsI can’t elevate privileges if I need toConfirmed…
  • 8. What about…I can’t interact with SharePoint Lists and LibrariesBusted… You can call Web Services with JavaScript (SPServices is a wonderful jQuery library that wraps SharePoints Web Service calls)It has no real use in my environment because of “x”Busted… Quickly prototype and tweak web parts before writing in Visual Studio. In fact, in some environments it is the only development option.
  • 9. Yeah But… It’s not deployableCreate central script document library for jQuery scriptsUpload new versions as neededTurn on versioning and store multiple versionsUse metadata to keep track of script informationStore on file systemDeploy with solution packageIncreased performance of loading from file system
  • 10. Okay… but… It’s not maintainableScript PlacementDon’t put your script source in the CEWPDon’t hardcode scripts in your MasterPagesAgain… deploy scripts to central script document library or to file system with solution packageIf stored in doc lib, turn on versioning to easily roll-back if needed.
  • 11. Moving Between Environments and Upgrading to 2010It just works… (woo hoo)Uses list names and not GUIDs so no issues moving from dev to prodFor the most part works identical in 2007 and 2010 (I’m sure there’s the occasional issue but I’ve never run into it).Might want to tweak in 2010 to take advantage of 2010 features (ribbin, modal pop-ups)
  • 12. Okay then…jQuery must be the SharePoint Silver BulletBusted…It does “expose” business logic to user if they dig aroundIt executes on the client side and can perform slow if manipulating larges amounts of dataBe extra careful for external facing applicationsYou can’t do EVERYTHING with jQuerylike…Timer JobsWorkflows (although it can eliminate the need for some)Event HandlersElevate PrivligesEasily interact with all business systems
  • 13. jQuery is another tool for the SharePoint Developer’s toolkitUnderstand the limitationsUse it wisely
  • 14. Development BasicsjQuery methods are executed using jQuery() or $()You don’t have to use $(document).ready() Use $() directly$(‘#elementID’) to interact with any element$(‘#elementID’).val() gets values of inputs$(‘#elementID’).val([value]) sets the values of inputs$(‘#elementID’).html() gets the raw html within an element (great for divs, spans, tables, table cells, etc.)$(‘#elementID’).html(“<html text>”) to set raw html$(‘#elementID’).hide() and $(‘#elementID’).show()
  • 15. Development Basicsvardivs = $(“div”);Returns all divs in the document$(‘#element’).addClass(“className”);$(‘#element’).removeClass(“className”);$(‘#element’).attr(“attributeName”);$(‘#element’).attr(“attributeName”,”attributeValue”);GET O’REILLY’S JQUERY POCKET REFERENCEhttp://oreilly.com/catalog/0636920016182
  • 16. More Dev BasicsEach loops$('table[class="myTable"]').each( function () { $('#' + this.id).hide(); });CDATA is a life saverWrap values in CDATA tags:"<![CDATA[" + data + "]]>"
  • 17. SPServicesjQuery library to execute SharePoint’s Web ServicesGet List ItemsAdd/Update List ItemsCreate lists, content types, site columns, etc.Create document library foldersCreate cascading drop down lists
  • 18. Get user groups and permissions
  • 19. Potentially call ANY SharePoint Web ServiceSPServicesWorks identical in SharePoint 2007 and SharePoint 2010Runs with permissions of current userCommunicate across sites
  • 22. SPServices - FYIUse internal field names Returned values have “ows_” in front of field names$(this).attr("ows_Title");Lookup & People fieldsValue returned as “ID;#Value” (1;#Field Value)Check for new item ID on item add to make sure item added correctlyvarnewID = $(xData.responseXML).find("[nodeName=z:row]").attr("ows_ID");
  • 23. Development TipsDevelop for performanceLimit rows returned using CAMLAvoid screen scraping (Use SPServices)Don’t call web services until the data is needed.Use those ID’s to your advantage<td id=‘ListName-4’>Attributes are awesome<input type="text" title="list title 4" id="4">$('#4').attr("title");
  • 24. Writing jQueryPick whatever editor makes you happy…Visual StudioI don’t use it, so can’t speak to itAptana (actual JavaScript IDE)Gives you some intellisenseNotePad++Good bracket matching which tends to bite you in the butt
  • 25. Debugging… ugh.. It ain’t prettyAlerts.. Alerts.. Alerts.. Alerts…Developer ToolsSet breakpointsEvaluate expressions and variables inline (like REAL debugging!)Firebug for Firefox Considered to be best of the free tools out thereIE Developer Tools Comes installed on IE 8+
  • 26. Debugging… Common ErrorsUsually it means your library didn’t get loadedObject ExpectedObject doesn’t support methodMake sure you don’t load scripts more than onceNull Object referenceCheck your bracesMake sure you end lines with “;”Check for missing quotesWhen all else fails, delete your script and rebuild it slowly in chunks, testing as you go.
  • 27. DEMOS
  • 28. How to get it…jQueryhttp://jquery.com/SPServiceshttp://spservices.codeplex.comSuper Awesome 3rd party libraries that integrate wellModal dialogs - http://www.ericmmartin.com/projects/simplemodal/Calendar - http://arshaw.com/fullcalendar/Charts - http://g.raphaeljs.com/
  • 29. More jQuery ResourcesjQuery Pocket Referencehttp://oreilly.com/catalog/0636920016182CSS Pocket Referncehttp://oreilly.com/catalog/9780596515058/