SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Customizing the SharePoint
2013 UI with JavaScript
Chris O’Brien - MVP
• Independent Consultant
• Head of Development, Content and Code
• Blog: www.sharepointnutsandbolts.com
• Twitter: @ChrisO_Brien
• LinkedIn: http://uk.linkedin.com/in/
chrisobrienmvp
About me
Long Ago…
SharePoint 2007
CAML
SharePoint 2010
XSL
…Today
SharePoint 2010
XSL
SharePoint 2013
CSR
• Content Search web
part
• Search hover panel
• List callouts
• Lists
• Fields
• Web parts etc..
Client-Side
Rendering (CSR)
JSLink
Display
Templates
Terminology
JSLink
• Used to transform:
– Lists
– Views
– Fields
– Web Parts
– Content types
CSR/JSLink – template scope
• Use SPView.JSLink = ‘~site/foo/MyFile.js’, but also
need to register templates
• Register by:
– BaseViewID (e.g. 1)
– ListTemplateType (e.g. 10001)
– ControlMode (e.g. ‘Display’)
Registering templates/running code
• The RenderContext JS object:
– Templates collection
• e.g. header, item, footer
• Register with BaseViewID, ListTemplateType, ControlMode
– OnPreRender
– OnPostRender
– ListData
– ListSchema
DEMO:
USING JSLINK WITH SHAREPOINT LISTS
www.sharepointeurope.com
Advanced CSR possibilities
• Modify list data/schema in OnPreRender
– E.g. lookup something dynamically
• Use SPClientRenderer.Render() to obtain HTML:
– From arbitrary data
– Outside of page context
– In AJAX methods
CUSTOMIZING THE CONTENT
SEARCH WEB PART
www.sharepointeurope.com
The role of Managed Properties
• CSWP has mappings to Managed Props for data:
CSWP and Display Templates
These items are files in
~sitecollection/_catalogs/masterpage/
Display Templates/
Content Web Parts
Diagnostic item template
• Diagnostic template gives
raw (ish) output
• Further tools:
– Elio Struyf’s “Ultimate
Diagnostic template”
– SharePoint 2013 Search
Query Tool (Codeplex)
DEMO:
CUSTOMIZING THE CSWP
www.sharepointeurope.com
Dynamic values in query
{User}
•Match profile field
e.g. User.Department
{Page}
•Match field value e.g.
Page.MyField
{Site}
•Match current site
e.g. Site.Url
{SiteCollection}
•Match current site
collection e.g.
SiteCollection.Url
{Today}
•Date filtering e.g.
Today-7
{Term}
•Match current
managed nav term
Several tokens available:
Provisioning Display Templates
• Two options in publishing sites:
Provision JS file only Provision HTML file only. “Touch” it to
generate JS file
+ No code required, just XML
(Module tag)
- Also need Feature receiver or remote
code to “touch” HTML file (for event
receiver to generate JS file)
- Updates can be difficult (edit
JS, or generate JS elsewhere)
+ Updates are easy (edit HTML)
= Recommended for Office 365 = Recommended for on-premises
SEARCH HOVER PANEL
www.sharepointeurope.com
SP2013 search recap
• Search scope on steroids
Result
Source
• Best Bet on steroidsQuery Rule
• E.g. Word doc, person,
social post etc.
Result Type
• Visual rendering of an itemDisplay
Template
Hover Panel components
Hover Panel components
- Item_CommonHoverPanel_Body.js
- Item_[FileType]_HoverPanel.js
Hover Panel actions
• Footer actions can also be
– Common
– Specific
• Gotcha! Some item types do not use Common
actions
– E.g. Discussion
- Item_CommonHoverPanel_Actions.js
- Item_[FileType]_HoverPanel.js
DEMO:
CUSTOMIZING THE SEARCH HOVER
PANEL
www.sharepointeurope.com
JS tips for display templates
• jQuery? Can’t use document.ready() – DOM is not populated
– Specify function in ctx.OnPostRender instead
– These functions are called ONCE (on first render [mouseover])
• N.B. Array of functions is accessible in all files e.g. header, body,
actions etc.
• DON’T delete _#= ctx.RenderBody(ctx) =#_
– This executes Item_CommonHoverPanel_Body.js (inheritance
model)
JS tips – useful code
• $includeScript (this.url, ~sitecollection/MyFile.js”)
• $includeCSS (this.url, ~sitecollection/MyFile.css”)
Load external files
• $getItemValue
Get Managed Property passed
to template
• Srch.U.getIconUrlByFileExtension
• Srch.U.getTrimmedString
• Srch.ScriptApplicationManager.get_clientRuntimeContext
Srch.U helper functions
(Search.ClientControls.js)
• displayTruncatedString()
• renderThumbnail()
• parseLookupValue()
Generic helper functions
(ClientTemplates.js)
Summary
• JavaScript is key to many SP2013 UI elements
• Examples shown:
– Customizing entire list UI
– Conditional formatting of a field
– Rendering of Content Search web part
– Customizing search hover panel (inc. AJAX)
• Lots of other possibilities too!
Resources
Resource URL
Display template reference (MSDN) http://cob-sp.com/1hoQM6z
Display templates on GitHub (SPCSR) https://github.com/spcsr
Ultimate Diagnostic display template (Elio
Struyf)
http://cob-sp.com/Rdd3Ox
SharePoint Search Query tool http://sp2013searchtool.codeplex.com
Useful JS for display templates (Corey
Roth)
http://cob-sp.com/1kB351Y
THANK YOU!
Questions?
www.sharepointnutsandbolts.com
@ChrisO_Brien

Weitere ähnliche Inhalte

Was ist angesagt?

Office 2013 loves web developers slide
Office 2013 loves web developers   slideOffice 2013 loves web developers   slide
Office 2013 loves web developers slide
Fabio Franzini
 
Building SharePoint Single Page Applications Using AngularJS
Building SharePoint Single Page Applications Using AngularJSBuilding SharePoint Single Page Applications Using AngularJS
Building SharePoint Single Page Applications Using AngularJS
SharePointInstitute
 
How to Improve the SharePoint UI Using Bootstrap 3
How to Improve the SharePoint UI Using Bootstrap 3How to Improve the SharePoint UI Using Bootstrap 3
How to Improve the SharePoint UI Using Bootstrap 3
Ryan McIntyre
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Fabio Franzini
 
Codemotion 2013 - Designing complex applications using html5 and knockoutjs
Codemotion 2013 - Designing complex applications using html5 and knockoutjsCodemotion 2013 - Designing complex applications using html5 and knockoutjs
Codemotion 2013 - Designing complex applications using html5 and knockoutjs
Fabio Franzini
 

Was ist angesagt? (20)

Introduction to using jQuery with SharePoint
Introduction to using jQuery with SharePointIntroduction to using jQuery with SharePoint
Introduction to using jQuery with SharePoint
 
Sviluppare app per office
Sviluppare app per officeSviluppare app per office
Sviluppare app per office
 
Office 2013 loves web developers slide
Office 2013 loves web developers   slideOffice 2013 loves web developers   slide
Office 2013 loves web developers slide
 
Chris O'Brien - Introduction to the SharePoint Framework for developers
Chris O'Brien - Introduction to the SharePoint Framework for developersChris O'Brien - Introduction to the SharePoint Framework for developers
Chris O'Brien - Introduction to the SharePoint Framework for developers
 
Come riprogettare le attuali farm solution di share point con il nuovo modell...
Come riprogettare le attuali farm solution di share point con il nuovo modell...Come riprogettare le attuali farm solution di share point con il nuovo modell...
Come riprogettare le attuali farm solution di share point con il nuovo modell...
 
SharePoint 2013 Client Side Rendering
SharePoint 2013 Client Side RenderingSharePoint 2013 Client Side Rendering
SharePoint 2013 Client Side Rendering
 
Building SharePoint Single Page Applications Using AngularJS
Building SharePoint Single Page Applications Using AngularJSBuilding SharePoint Single Page Applications Using AngularJS
Building SharePoint Single Page Applications Using AngularJS
 
SPSSTHLM - Using JSLink and Display Templates for ITPros
SPSSTHLM - Using JSLink and Display Templates for ITProsSPSSTHLM - Using JSLink and Display Templates for ITPros
SPSSTHLM - Using JSLink and Display Templates for ITPros
 
Building productivity solutions with Microsoft Graph
Building productivity solutions with Microsoft GraphBuilding productivity solutions with Microsoft Graph
Building productivity solutions with Microsoft Graph
 
Using js link and display templates
Using js link and display templatesUsing js link and display templates
Using js link and display templates
 
How to Improve the SharePoint UI Using Bootstrap 3
How to Improve the SharePoint UI Using Bootstrap 3How to Improve the SharePoint UI Using Bootstrap 3
How to Improve the SharePoint UI Using Bootstrap 3
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
TulsaTechFest - Maximize SharePoint UX with free jQuery libraries
TulsaTechFest - Maximize SharePoint UX with free jQuery librariesTulsaTechFest - Maximize SharePoint UX with free jQuery libraries
TulsaTechFest - Maximize SharePoint UX with free jQuery libraries
 
Codemotion 2013 - Designing complex applications using html5 and knockoutjs
Codemotion 2013 - Designing complex applications using html5 and knockoutjsCodemotion 2013 - Designing complex applications using html5 and knockoutjs
Codemotion 2013 - Designing complex applications using html5 and knockoutjs
 
Working with a super model for SharePoint Tuga IT 2016
Working with a super model for SharePoint Tuga IT 2016Working with a super model for SharePoint Tuga IT 2016
Working with a super model for SharePoint Tuga IT 2016
 
Share point saturday presentation 9 29-2012-2
Share point saturday presentation 9 29-2012-2Share point saturday presentation 9 29-2012-2
Share point saturday presentation 9 29-2012-2
 
O365 Saturday - Deepdive SharePoint Client Side Rendering
O365 Saturday - Deepdive SharePoint Client Side RenderingO365 Saturday - Deepdive SharePoint Client Side Rendering
O365 Saturday - Deepdive SharePoint Client Side Rendering
 
Building SharePoint add-ins with JavaScript and c# sps Silicon Valley
Building SharePoint add-ins with JavaScript and c# sps Silicon ValleyBuilding SharePoint add-ins with JavaScript and c# sps Silicon Valley
Building SharePoint add-ins with JavaScript and c# sps Silicon Valley
 
SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates
SharePoint 2013 Client-Side Rendering (CSR) & JSLink TemplatesSharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates
SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates
 
SharePoint and the User Interface with JavaScript
SharePoint and the User Interface with JavaScriptSharePoint and the User Interface with JavaScript
SharePoint and the User Interface with JavaScript
 

Andere mochten auch

Integrating SharePoint with Exchange-2013
Integrating SharePoint with Exchange-2013Integrating SharePoint with Exchange-2013
Integrating SharePoint with Exchange-2013
Randy Williams
 
Exchange Server 2013 and SharePoint Server 2013 Integration
Exchange Server 2013 and SharePoint Server 2013 IntegrationExchange Server 2013 and SharePoint Server 2013 Integration
Exchange Server 2013 and SharePoint Server 2013 Integration
SharePoint Saturday New Jersey
 

Andere mochten auch (20)

Branding Deployment in Office 365 and SharePoint 2013/2016
Branding Deployment in Office 365 and SharePoint 2013/2016Branding Deployment in Office 365 and SharePoint 2013/2016
Branding Deployment in Office 365 and SharePoint 2013/2016
 
Broaden your dev skillset with SharePoint branding options
Broaden your dev skillset with SharePoint branding optionsBroaden your dev skillset with SharePoint branding options
Broaden your dev skillset with SharePoint branding options
 
Branding Modern SharePoint
Branding Modern SharePointBranding Modern SharePoint
Branding Modern SharePoint
 
Cross Site Publishing Solution for corporate news in SP 2013
Cross Site Publishing Solution for corporate news in SP 2013Cross Site Publishing Solution for corporate news in SP 2013
Cross Site Publishing Solution for corporate news in SP 2013
 
SPS Québec - Votre intranet "Client-Side" en SharePoint Online/O365 avec PnP,...
SPS Québec - Votre intranet "Client-Side" en SharePoint Online/O365 avec PnP,...SPS Québec - Votre intranet "Client-Side" en SharePoint Online/O365 avec PnP,...
SPS Québec - Votre intranet "Client-Side" en SharePoint Online/O365 avec PnP,...
 
Integrating SharePoint with Exchange-2013
Integrating SharePoint with Exchange-2013Integrating SharePoint with Exchange-2013
Integrating SharePoint with Exchange-2013
 
Gouvernance des projets SharePoint 2013
Gouvernance des projets SharePoint 2013Gouvernance des projets SharePoint 2013
Gouvernance des projets SharePoint 2013
 
Exchange Server 2013 and SharePoint Server 2013 Integration
Exchange Server 2013 and SharePoint Server 2013 IntegrationExchange Server 2013 and SharePoint Server 2013 Integration
Exchange Server 2013 and SharePoint Server 2013 Integration
 
Branding office 365 Netherlands
Branding office 365 NetherlandsBranding office 365 Netherlands
Branding office 365 Netherlands
 
Your SharePoint 2013 Branding Initiation
Your SharePoint 2013 Branding InitiationYour SharePoint 2013 Branding Initiation
Your SharePoint 2013 Branding Initiation
 
The Future of SharePoint - What You Need to Know
The Future of SharePoint - What You Need to KnowThe Future of SharePoint - What You Need to Know
The Future of SharePoint - What You Need to Know
 
Branding office 365 copenhagen
Branding office 365 copenhagenBranding office 365 copenhagen
Branding office 365 copenhagen
 
Microsoft Ignite 2016 In Review
Microsoft Ignite 2016 In ReviewMicrosoft Ignite 2016 In Review
Microsoft Ignite 2016 In Review
 
Office 365 branding webinar
Office 365 branding webinarOffice 365 branding webinar
Office 365 branding webinar
 
How design is transforming modern intranets
How design is transforming modern intranetsHow design is transforming modern intranets
How design is transforming modern intranets
 
Backup & Restore SharePoint 2013 Farm
Backup & Restore SharePoint 2013 FarmBackup & Restore SharePoint 2013 Farm
Backup & Restore SharePoint 2013 Farm
 
SharePoint Framework, React, and Office UI sps Silicon Valley
SharePoint Framework, React, and Office UI sps Silicon ValleySharePoint Framework, React, and Office UI sps Silicon Valley
SharePoint Framework, React, and Office UI sps Silicon Valley
 
Branding Office 365 SharePoint Days
Branding Office 365 SharePoint DaysBranding Office 365 SharePoint Days
Branding Office 365 SharePoint Days
 
European SharePoint Webinar - Make SharePoint Sassy
European SharePoint Webinar - Make SharePoint SassyEuropean SharePoint Webinar - Make SharePoint Sassy
European SharePoint Webinar - Make SharePoint Sassy
 
Design Manager 2013
Design Manager 2013  Design Manager 2013
Design Manager 2013
 

Ähnlich wie Chris O'Brien - Customizing the SharePoint/Office 365 UI with JavaScript (ESPC14)

Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Lucidworks
 
SharePoint Saturday Belgium 2014 - Using JSLink and Display Templates with th...
SharePoint Saturday Belgium 2014 - Using JSLink and Display Templates with th...SharePoint Saturday Belgium 2014 - Using JSLink and Display Templates with th...
SharePoint Saturday Belgium 2014 - Using JSLink and Display Templates with th...
BIWUG
 
Intro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniterIntro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniter
brightrocket
 

Ähnlich wie Chris O'Brien - Customizing the SharePoint/Office 365 UI with JavaScript (ESPC14) (20)

Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
 
#SPSLondon - Session 2 JSLink for IT Pros
#SPSLondon - Session 2 JSLink for IT Pros#SPSLondon - Session 2 JSLink for IT Pros
#SPSLondon - Session 2 JSLink for IT Pros
 
The SharePoint & jQuery Guide
The SharePoint & jQuery GuideThe SharePoint & jQuery Guide
The SharePoint & jQuery Guide
 
The SharePoint and jQuery Guide by Mark Rackley - SPTechCon
The SharePoint and jQuery Guide by Mark Rackley - SPTechConThe SharePoint and jQuery Guide by Mark Rackley - SPTechCon
The SharePoint and jQuery Guide by Mark Rackley - SPTechCon
 
SUGUK Cambridge - Display Templates & JSLink for IT Pros
SUGUK Cambridge - Display Templates & JSLink for IT ProsSUGUK Cambridge - Display Templates & JSLink for IT Pros
SUGUK Cambridge - Display Templates & JSLink for IT Pros
 
SPSTC - SharePoint & jQuery Essentials
SPSTC - SharePoint & jQuery EssentialsSPSTC - SharePoint & jQuery Essentials
SPSTC - SharePoint & jQuery Essentials
 
SharePoint Saturday Belgium 2014 - Using JSLink and Display Templates with th...
SharePoint Saturday Belgium 2014 - Using JSLink and Display Templates with th...SharePoint Saturday Belgium 2014 - Using JSLink and Display Templates with th...
SharePoint Saturday Belgium 2014 - Using JSLink and Display Templates with th...
 
Spsbe using js-linkanddisplaytemplates
Spsbe   using js-linkanddisplaytemplatesSpsbe   using js-linkanddisplaytemplates
Spsbe using js-linkanddisplaytemplates
 
SPSDenver - SharePoint & jQuery - What I wish I would have known
SPSDenver - SharePoint & jQuery - What I wish I would have knownSPSDenver - SharePoint & jQuery - What I wish I would have known
SPSDenver - SharePoint & jQuery - What I wish I would have known
 
Social features in SharePoint 2013
Social features in SharePoint 2013Social features in SharePoint 2013
Social features in SharePoint 2013
 
2013 SPFest - Customizing Sites and Pages in SharePoint 2013
2013 SPFest - Customizing Sites and Pages in SharePoint 20132013 SPFest - Customizing Sites and Pages in SharePoint 2013
2013 SPFest - Customizing Sites and Pages in SharePoint 2013
 
Your Intranet, Your Way
Your Intranet, Your WayYour Intranet, Your Way
Your Intranet, Your Way
 
SEF2013 - A jQuery Primer for SharePoint
SEF2013 - A jQuery Primer for SharePointSEF2013 - A jQuery Primer for SharePoint
SEF2013 - A jQuery Primer for SharePoint
 
The SharePoint & jQuery Guide - Updated 1/14/14
The SharePoint & jQuery Guide - Updated 1/14/14The SharePoint & jQuery Guide - Updated 1/14/14
The SharePoint & jQuery Guide - Updated 1/14/14
 
JSLink for ITPros - SharePoint Saturday Jersey
JSLink for ITPros - SharePoint Saturday JerseyJSLink for ITPros - SharePoint Saturday Jersey
JSLink for ITPros - SharePoint Saturday Jersey
 
Customize it! Make IBM Connections look your way
Customize it! Make IBM Connections look your way Customize it! Make IBM Connections look your way
Customize it! Make IBM Connections look your way
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojo
 
Intro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniterIntro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniter
 
Houston tech fest dev intro to sharepoint search
Houston tech fest   dev intro to sharepoint searchHouston tech fest   dev intro to sharepoint search
Houston tech fest dev intro to sharepoint search
 
SharePoint Development(Lesson 5)
SharePoint Development(Lesson 5)SharePoint Development(Lesson 5)
SharePoint Development(Lesson 5)
 

Mehr von Chris O'Brien

Mehr von Chris O'Brien (20)

Chris O'Brien - Building AI into Power Platform solutions
Chris O'Brien - Building AI into Power Platform solutionsChris O'Brien - Building AI into Power Platform solutions
Chris O'Brien - Building AI into Power Platform solutions
 
Chris OBrien - Azure DevOps for managing work
Chris OBrien - Azure DevOps for managing workChris OBrien - Azure DevOps for managing work
Chris OBrien - Azure DevOps for managing work
 
Chris O'Brien - Ignite 2019 announcements and selected roadmaps
Chris O'Brien - Ignite 2019 announcements and selected roadmapsChris O'Brien - Ignite 2019 announcements and selected roadmaps
Chris O'Brien - Ignite 2019 announcements and selected roadmaps
 
COB ESPC18 - Rich PowerApps with offline support
COB ESPC18 - Rich PowerApps with offline supportCOB ESPC18 - Rich PowerApps with offline support
COB ESPC18 - Rich PowerApps with offline support
 
COB - Azure Functions for Office 365 developers
COB - Azure Functions for Office 365 developersCOB - Azure Functions for Office 365 developers
COB - Azure Functions for Office 365 developers
 
COB - PowerApps - the good, the bad and the ugly - early 2018
COB - PowerApps - the good, the bad and the ugly - early 2018COB - PowerApps - the good, the bad and the ugly - early 2018
COB - PowerApps - the good, the bad and the ugly - early 2018
 
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
 
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developers
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developersChris O'Brien - Best bits of Azure for Office 365/SharePoint developers
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developers
 
Chris O'Brien - Intro to Power BI for Office 365 devs (March 2017)
Chris O'Brien - Intro to Power BI for Office 365 devs (March 2017)Chris O'Brien - Intro to Power BI for Office 365 devs (March 2017)
Chris O'Brien - Intro to Power BI for Office 365 devs (March 2017)
 
Chris O'Brien - Modern SharePoint sites and the SharePoint Framework - reference
Chris O'Brien - Modern SharePoint sites and the SharePoint Framework - referenceChris O'Brien - Modern SharePoint sites and the SharePoint Framework - reference
Chris O'Brien - Modern SharePoint sites and the SharePoint Framework - reference
 
Application Lifecycle Management for Office 365 development
Application Lifecycle Management for Office 365 developmentApplication Lifecycle Management for Office 365 development
Application Lifecycle Management for Office 365 development
 
Do's and don'ts for Office 365 development
Do's and don'ts for Office 365 developmentDo's and don'ts for Office 365 development
Do's and don'ts for Office 365 development
 
Deep dive into SharePoint 2013 hosted apps - Chris OBrien
Deep dive into SharePoint 2013 hosted apps - Chris OBrienDeep dive into SharePoint 2013 hosted apps - Chris OBrien
Deep dive into SharePoint 2013 hosted apps - Chris OBrien
 
SP2013 for Developers - Chris O'Brien
SP2013 for Developers - Chris O'BrienSP2013 for Developers - Chris O'Brien
SP2013 for Developers - Chris O'Brien
 
Getting to grips with SharePoint 2013 apps - Chris O'Brien
Getting to grips with SharePoint 2013 apps - Chris O'BrienGetting to grips with SharePoint 2013 apps - Chris O'Brien
Getting to grips with SharePoint 2013 apps - Chris O'Brien
 
SharePoint Ribbon Deep Dive
SharePoint Ribbon Deep DiveSharePoint Ribbon Deep Dive
SharePoint Ribbon Deep Dive
 
Automated Builds And UI Testing in SharePoint 2010 Development
Automated Builds And UI Testing in SharePoint 2010 DevelopmentAutomated Builds And UI Testing in SharePoint 2010 Development
Automated Builds And UI Testing in SharePoint 2010 Development
 
Optimizing SharePoint 2010 Internet Sites
Optimizing SharePoint 2010 Internet SitesOptimizing SharePoint 2010 Internet Sites
Optimizing SharePoint 2010 Internet Sites
 
Managing the SharePoint 2010 Application Lifecycle - Part 2
Managing the SharePoint 2010 Application Lifecycle - Part 2Managing the SharePoint 2010 Application Lifecycle - Part 2
Managing the SharePoint 2010 Application Lifecycle - Part 2
 
Managing the SharePoint 2010 Application Lifecycle - Part 1
Managing the SharePoint 2010 Application Lifecycle - Part 1Managing the SharePoint 2010 Application Lifecycle - Part 1
Managing the SharePoint 2010 Application Lifecycle - Part 1
 

Kürzlich hochgeladen

valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
imonikaupta
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
 

Kürzlich hochgeladen (20)

Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 

Chris O'Brien - Customizing the SharePoint/Office 365 UI with JavaScript (ESPC14)

  • 1. Customizing the SharePoint 2013 UI with JavaScript Chris O’Brien - MVP
  • 2. • Independent Consultant • Head of Development, Content and Code • Blog: www.sharepointnutsandbolts.com • Twitter: @ChrisO_Brien • LinkedIn: http://uk.linkedin.com/in/ chrisobrienmvp About me
  • 5. • Content Search web part • Search hover panel • List callouts • Lists • Fields • Web parts etc.. Client-Side Rendering (CSR) JSLink Display Templates Terminology
  • 6. JSLink • Used to transform: – Lists – Views – Fields – Web Parts – Content types
  • 7. CSR/JSLink – template scope • Use SPView.JSLink = ‘~site/foo/MyFile.js’, but also need to register templates • Register by: – BaseViewID (e.g. 1) – ListTemplateType (e.g. 10001) – ControlMode (e.g. ‘Display’)
  • 8. Registering templates/running code • The RenderContext JS object: – Templates collection • e.g. header, item, footer • Register with BaseViewID, ListTemplateType, ControlMode – OnPreRender – OnPostRender – ListData – ListSchema
  • 9. DEMO: USING JSLINK WITH SHAREPOINT LISTS www.sharepointeurope.com
  • 10. Advanced CSR possibilities • Modify list data/schema in OnPreRender – E.g. lookup something dynamically • Use SPClientRenderer.Render() to obtain HTML: – From arbitrary data – Outside of page context – In AJAX methods
  • 11. CUSTOMIZING THE CONTENT SEARCH WEB PART www.sharepointeurope.com
  • 12. The role of Managed Properties • CSWP has mappings to Managed Props for data:
  • 13. CSWP and Display Templates These items are files in ~sitecollection/_catalogs/masterpage/ Display Templates/ Content Web Parts
  • 14. Diagnostic item template • Diagnostic template gives raw (ish) output • Further tools: – Elio Struyf’s “Ultimate Diagnostic template” – SharePoint 2013 Search Query Tool (Codeplex)
  • 16. Dynamic values in query {User} •Match profile field e.g. User.Department {Page} •Match field value e.g. Page.MyField {Site} •Match current site e.g. Site.Url {SiteCollection} •Match current site collection e.g. SiteCollection.Url {Today} •Date filtering e.g. Today-7 {Term} •Match current managed nav term Several tokens available:
  • 17. Provisioning Display Templates • Two options in publishing sites: Provision JS file only Provision HTML file only. “Touch” it to generate JS file + No code required, just XML (Module tag) - Also need Feature receiver or remote code to “touch” HTML file (for event receiver to generate JS file) - Updates can be difficult (edit JS, or generate JS elsewhere) + Updates are easy (edit HTML) = Recommended for Office 365 = Recommended for on-premises
  • 19. SP2013 search recap • Search scope on steroids Result Source • Best Bet on steroidsQuery Rule • E.g. Word doc, person, social post etc. Result Type • Visual rendering of an itemDisplay Template
  • 21. Hover Panel components - Item_CommonHoverPanel_Body.js - Item_[FileType]_HoverPanel.js
  • 22. Hover Panel actions • Footer actions can also be – Common – Specific • Gotcha! Some item types do not use Common actions – E.g. Discussion - Item_CommonHoverPanel_Actions.js - Item_[FileType]_HoverPanel.js
  • 23. DEMO: CUSTOMIZING THE SEARCH HOVER PANEL www.sharepointeurope.com
  • 24. JS tips for display templates • jQuery? Can’t use document.ready() – DOM is not populated – Specify function in ctx.OnPostRender instead – These functions are called ONCE (on first render [mouseover]) • N.B. Array of functions is accessible in all files e.g. header, body, actions etc. • DON’T delete _#= ctx.RenderBody(ctx) =#_ – This executes Item_CommonHoverPanel_Body.js (inheritance model)
  • 25. JS tips – useful code • $includeScript (this.url, ~sitecollection/MyFile.js”) • $includeCSS (this.url, ~sitecollection/MyFile.css”) Load external files • $getItemValue Get Managed Property passed to template • Srch.U.getIconUrlByFileExtension • Srch.U.getTrimmedString • Srch.ScriptApplicationManager.get_clientRuntimeContext Srch.U helper functions (Search.ClientControls.js) • displayTruncatedString() • renderThumbnail() • parseLookupValue() Generic helper functions (ClientTemplates.js)
  • 26. Summary • JavaScript is key to many SP2013 UI elements • Examples shown: – Customizing entire list UI – Conditional formatting of a field – Rendering of Content Search web part – Customizing search hover panel (inc. AJAX) • Lots of other possibilities too!
  • 27. Resources Resource URL Display template reference (MSDN) http://cob-sp.com/1hoQM6z Display templates on GitHub (SPCSR) https://github.com/spcsr Ultimate Diagnostic display template (Elio Struyf) http://cob-sp.com/Rdd3Ox SharePoint Search Query tool http://sp2013searchtool.codeplex.com Useful JS for display templates (Corey Roth) http://cob-sp.com/1kB351Y