SlideShare une entreprise Scribd logo
1  sur  45
Télécharger pour lire hors ligne
Using JSLink and Display Templates with
List View Web Parts for ITPros
#SPSSTHLM19
Paul Hunt (@cimares)
January 25th, 2014

SharePoint Saturday

Stockholm
Gold

SharePint

Bronze
Raffle
Who Am I?
SharePoint Architect for Trinity
Expert Systems
• Co-organiser of SUGUK
London Region
• Member of the SharePoint
community since 2007
• In my spare time I’m a
woodturner, making Pots,
Pens and artistic pieces!
•

• Paul Hunt
• Twitter: @Cimares
What is this session all about?
•

The List View Web Part
Who’s this session for?
•

Primarily First/Second tier developers
 ITPros who customised 2010 list views in SPD
 ITPros that used to write their own XSLT in SP2010
 Developers that want to know what's available before opening VS2012

•

On Premises or Office 365 Deployments

• Might not be ideal for someone who isn’t comfortable with JavaScript, HTML
and CSS.
– Though if you used to play in SPD 2010 you’re halfway there!
– If you want to know what's achievable without deployed solutions
What did we used to do?
•

We used SPD and the Design View
 We did conditional formatting
 Played with colours
 Injected Hyperlinks
What did we used to do?
•

But
 No design view anymore!
What did we used to do?
•

We used XSLT Overrides (Still exist, but deprecated!)
What did we used to do?
•

We used XSLT Overrides (Still exist, but deprecated!)
 Which took boring list data views
What did we used to do?
•

We used XSLT Overrides (Still exist, but deprecated!)
 And transformed them into engaging visual representations
What did we used to do?
•

We used custom code solutions (We still can!)
 Custom CAML Rendering Templates
 Custom List Views
 Custom Web Parts

• All bring additional headaches
So why the focus on Client Side Rendering?
So why the focus on Client Side Rendering?
•

It’s client side, moving the impact of customisations off of the web server
and onto the often powerful and under utilised client machine

SETI@Home
Folding@Home
So why the focus on Client Side Rendering?
•

It’s client side, moving the impact of customisations off of the web server
and onto the often powerful and under utilised client machine

• Some client machines may struggle with heavy Javascript loads!
Specifically why JavaScript, HTML and CSS?
It’s easier to develop..
• Much simpler than XSLT
• Certainly easier to troubleshoot than XSLT
• Likely to have the skills in house
• Cross-platform (ish!)
•

 Some frameworks such as jQuery help with this
Exactly what is a JavaScript Display Template?
A small piece of JavaScript code that is called by the
browser AFTER the page has been delivered.
• They are prolific in SharePoint 2013
•

 Some examples
 Search Results
 Field Rendering
 Search Refiners
 List Forms
 List views
 eDiscovery
LVWP Templates != Search Display Templates

17

LVWP Display Templates are JavaScript only.
• They do not start life as HTML like Display Templates for
search do.
• They do not require embedded properties.
• CONTEXT (ctx) is king!
•
We’re just looking at:•

List View Display Templates
 These provide the ability to override the rendering of an entire view

•

Field Rendering Display Templates
 These provide the ability to override the rendering of a single field in a list

view
Anatomy of a List View Display Template
Start with an empty .JS (Or copy my examples)
• Define a Function to register the Display Template
• Define the Function called by the Display Template for
each item.
• Call the register function
•
Anatomy of a List View Display Template
•

Define a Function to register the Display Template

For a list of template types see - http://bit.ly/169AbS9
Anatomy of a List View Display Template
•

Define the Function called by the Display Template

• Note the use of ctx.CurrentItem.Title
– Any field in the view can be obtained this way
– You must use the internal name
• Obtained from the edit column screen
Anatomy of a List View Display Template
•

Call the function we defined when the page loads.
Anatomy of a Field Rendering Display Template
•

All that really changes is the override set-up

• This time there are no headers/footers
• We only specify the Base View ID/Field Name
Anatomy of a Field Rendering Display Template
•

The render function is similar to the list view
How do we use them with List Views?
•

First we need to upload/create them in the MasterPage
gallery
How do we use them with List Views?
•

Set some metadata
How do we use them with List Views?
•

Add a link into the JSLink on the web part

• Note the ~token in use
–
–
–
–
–

~sitecollection
~site
~layouts
~sitecollectionlayouts
~sitelayouts

• You can have multiple JSLinks
– Join them with |
Adding JSLink Demo
How do we troubleshoot?
•

IE Developers Toolbar (Other debuggers exist!)
How do we troubleshoot?
•

Fiddler – HTTP Proxy
How do we troubleshoot?
•

Fiddler – HTTP Proxy
Troubleshooting in IE with the F12
Dashboard

http://bit.ly/12kMPvr
There has to be a catch?
Minimal Download Strategy
• Multiple list views on a page
• Changing SharePoint functionality
•
There has to be a catch?
•

Minimal Download Strategy
 Our display templates work on page load
 But fail during a refresh.
 This is because our JavaScript doesn’t get called a second time

Two workarounds!
• Turn off the Minimal Download Feature in each Web
•

• Include the relevant JavaScript in your Display Template code
There has to be a catch?
•

Multiple list views on a page
 Because of the way Display Templates are registered, it’s not possible to have

two on the page if the list templates are the same.
(E.g. Custom TemplateType = 100)
 There is a workaround though published on my blog
 http://bit.ly/136e0e3
There has to be a catch?
•

Changing/Breaking SharePoint functionality
 For example, overriding the Tasks view breaks SharePoint rendering.
 This is fixed in the earlier Field demo with a couple of lines of JavaScript.
Page lifecycle
•

SharePoint outputs JSLink in the Header of the page
 This registers our Display Template
Page lifecycle
•

SharePoint LVWP outputs the list data into the page
 JSON Object Format
Page lifecycle
•

And finally after setting things up
 Calls the RenderListView() function for the web part.

• Which in turn:
– Calls the GetTemplates()
Page lifecycle
•

Which compares the Context object to the list of
registered overrides

• And if everything is in place, our override
wins the battle!
Display Template Demos
Questions?
Call to Action!
•

Take a look at these sites for more detailed info

Wes Preston – JS Link a primer - http://bit.ly/102fcNa
• Martin Hatch – JSLink 7 part series - http://bit.ly/Hh5zFk
• My blog
•

 Solving the multiple list view issue - http://bit.ly/JSLinkIssues
 Editing local JS files using fiddler - http://bit.ly/EditUsingFiddler

43
Don’t forget SharePint!
•

SHARE·PINT: [SHAIR-PAHYNT]
Noun
1. An assembly or meeting in relation to Microsoft
SharePoint, accompanied with an alcoholic beverage.
Using JSLink and Display Templates to Customize List Views

Contenu connexe

Tendances

Customizing the SharePoint 2013 user interface with JavaScript - Chris OBrien
Customizing the SharePoint 2013 user interface with JavaScript - Chris OBrienCustomizing the SharePoint 2013 user interface with JavaScript - Chris OBrien
Customizing the SharePoint 2013 user interface with JavaScript - Chris OBrienChris O'Brien
 
SharePoint Branding From Start to Finish
SharePoint Branding From Start to FinishSharePoint Branding From Start to Finish
SharePoint Branding From Start to FinishKanwal Khipple
 
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 RenderingRiwut Libinuko
 
#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 ProsPaul Hunt
 
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 2013Wes Preston
 
ECS 19 Bert Jansen - Taking your SharePoint to the next level – Transforming ...
ECS 19 Bert Jansen - Taking your SharePoint to the next level – Transforming ...ECS 19 Bert Jansen - Taking your SharePoint to the next level – Transforming ...
ECS 19 Bert Jansen - Taking your SharePoint to the next level – Transforming ...European Collaboration Summit
 
Deep Dive into the Content Query Web Part by Christina Wheeler - SPTechCon
Deep Dive into the Content Query Web Part by Christina Wheeler - SPTechConDeep Dive into the Content Query Web Part by Christina Wheeler - SPTechCon
Deep Dive into the Content Query Web Part by Christina Wheeler - SPTechConSPTechCon
 
Gabriel Gayhart - XML Pointer File Example
Gabriel Gayhart - XML Pointer File ExampleGabriel Gayhart - XML Pointer File Example
Gabriel Gayhart - XML Pointer File Examplelinkedinsys
 
SharePoint Branding Guidance @ SharePoint Saturday Redmond
SharePoint Branding Guidance @ SharePoint Saturday RedmondSharePoint Branding Guidance @ SharePoint Saturday Redmond
SharePoint Branding Guidance @ SharePoint Saturday RedmondKanwal Khipple
 
Automating SQL Server Database Creation for SharePoint
Automating SQL Server Database Creation for SharePointAutomating SQL Server Database Creation for SharePoint
Automating SQL Server Database Creation for SharePointTalbott Crowell
 
The A to Z of Building a Responsive SharePoint Site with Bootstrap
The A to Z of Building a Responsive SharePoint Site with BootstrapThe A to Z of Building a Responsive SharePoint Site with Bootstrap
The A to Z of Building a Responsive SharePoint Site with BootstrapThomas Daly
 
SharePoint Saturday Kansas 2015 - Building Killer Office365 Public Sites
SharePoint Saturday Kansas 2015 - Building Killer Office365 Public SitesSharePoint Saturday Kansas 2015 - Building Killer Office365 Public Sites
SharePoint Saturday Kansas 2015 - Building Killer Office365 Public SitesBrian Culver
 
Enhance SharePoint 2013 with Responsive Web Design
Enhance SharePoint 2013 with Responsive Web DesignEnhance SharePoint 2013 with Responsive Web Design
Enhance SharePoint 2013 with Responsive Web DesignEric Overfield
 
SharePointFest 2013 Washington DC - WF 204 - Build scalable SharePoint 2013 S...
SharePointFest 2013 Washington DC - WF 204 - Build scalable SharePoint 2013 S...SharePointFest 2013 Washington DC - WF 204 - Build scalable SharePoint 2013 S...
SharePointFest 2013 Washington DC - WF 204 - Build scalable SharePoint 2013 S...Brian Culver
 
A Power User's Intro to jQuery Awesomeness in SharePoint
A Power User's Intro to jQuery Awesomeness in SharePointA Power User's Intro to jQuery Awesomeness in SharePoint
A Power User's Intro to jQuery Awesomeness in SharePointMark Rackley
 
Integrating Search Driven Content in SharePoint 2013/2016/O365
Integrating Search Driven Content in SharePoint 2013/2016/O365Integrating Search Driven Content in SharePoint 2013/2016/O365
Integrating Search Driven Content in SharePoint 2013/2016/O365Eric Overfield
 
SharePoint Framework, React and Office UI SPS Paris 2016 - d01
SharePoint Framework, React and Office UI SPS Paris 2016 - d01SharePoint Framework, React and Office UI SPS Paris 2016 - d01
SharePoint Framework, React and Office UI SPS Paris 2016 - d01Sonja Madsen
 
Using jQuery to Maximize Form Usability
Using jQuery to Maximize Form UsabilityUsing jQuery to Maximize Form Usability
Using jQuery to Maximize Form UsabilityMark Rackley
 
ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...
ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...
ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...European Collaboration Summit
 
SharePoint Saturday Utah 2015 - SP2013 Search Driven Sites
SharePoint Saturday Utah 2015 - SP2013 Search Driven SitesSharePoint Saturday Utah 2015 - SP2013 Search Driven Sites
SharePoint Saturday Utah 2015 - SP2013 Search Driven SitesBrian Culver
 

Tendances (20)

Customizing the SharePoint 2013 user interface with JavaScript - Chris OBrien
Customizing the SharePoint 2013 user interface with JavaScript - Chris OBrienCustomizing the SharePoint 2013 user interface with JavaScript - Chris OBrien
Customizing the SharePoint 2013 user interface with JavaScript - Chris OBrien
 
SharePoint Branding From Start to Finish
SharePoint Branding From Start to FinishSharePoint Branding From Start to Finish
SharePoint Branding From Start to Finish
 
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
 
#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
 
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
 
ECS 19 Bert Jansen - Taking your SharePoint to the next level – Transforming ...
ECS 19 Bert Jansen - Taking your SharePoint to the next level – Transforming ...ECS 19 Bert Jansen - Taking your SharePoint to the next level – Transforming ...
ECS 19 Bert Jansen - Taking your SharePoint to the next level – Transforming ...
 
Deep Dive into the Content Query Web Part by Christina Wheeler - SPTechCon
Deep Dive into the Content Query Web Part by Christina Wheeler - SPTechConDeep Dive into the Content Query Web Part by Christina Wheeler - SPTechCon
Deep Dive into the Content Query Web Part by Christina Wheeler - SPTechCon
 
Gabriel Gayhart - XML Pointer File Example
Gabriel Gayhart - XML Pointer File ExampleGabriel Gayhart - XML Pointer File Example
Gabriel Gayhart - XML Pointer File Example
 
SharePoint Branding Guidance @ SharePoint Saturday Redmond
SharePoint Branding Guidance @ SharePoint Saturday RedmondSharePoint Branding Guidance @ SharePoint Saturday Redmond
SharePoint Branding Guidance @ SharePoint Saturday Redmond
 
Automating SQL Server Database Creation for SharePoint
Automating SQL Server Database Creation for SharePointAutomating SQL Server Database Creation for SharePoint
Automating SQL Server Database Creation for SharePoint
 
The A to Z of Building a Responsive SharePoint Site with Bootstrap
The A to Z of Building a Responsive SharePoint Site with BootstrapThe A to Z of Building a Responsive SharePoint Site with Bootstrap
The A to Z of Building a Responsive SharePoint Site with Bootstrap
 
SharePoint Saturday Kansas 2015 - Building Killer Office365 Public Sites
SharePoint Saturday Kansas 2015 - Building Killer Office365 Public SitesSharePoint Saturday Kansas 2015 - Building Killer Office365 Public Sites
SharePoint Saturday Kansas 2015 - Building Killer Office365 Public Sites
 
Enhance SharePoint 2013 with Responsive Web Design
Enhance SharePoint 2013 with Responsive Web DesignEnhance SharePoint 2013 with Responsive Web Design
Enhance SharePoint 2013 with Responsive Web Design
 
SharePointFest 2013 Washington DC - WF 204 - Build scalable SharePoint 2013 S...
SharePointFest 2013 Washington DC - WF 204 - Build scalable SharePoint 2013 S...SharePointFest 2013 Washington DC - WF 204 - Build scalable SharePoint 2013 S...
SharePointFest 2013 Washington DC - WF 204 - Build scalable SharePoint 2013 S...
 
A Power User's Intro to jQuery Awesomeness in SharePoint
A Power User's Intro to jQuery Awesomeness in SharePointA Power User's Intro to jQuery Awesomeness in SharePoint
A Power User's Intro to jQuery Awesomeness in SharePoint
 
Integrating Search Driven Content in SharePoint 2013/2016/O365
Integrating Search Driven Content in SharePoint 2013/2016/O365Integrating Search Driven Content in SharePoint 2013/2016/O365
Integrating Search Driven Content in SharePoint 2013/2016/O365
 
SharePoint Framework, React and Office UI SPS Paris 2016 - d01
SharePoint Framework, React and Office UI SPS Paris 2016 - d01SharePoint Framework, React and Office UI SPS Paris 2016 - d01
SharePoint Framework, React and Office UI SPS Paris 2016 - d01
 
Using jQuery to Maximize Form Usability
Using jQuery to Maximize Form UsabilityUsing jQuery to Maximize Form Usability
Using jQuery to Maximize Form Usability
 
ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...
ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...
ECS19 - Laura Kokkarinen - Everything you need to know about SharePoint site ...
 
SharePoint Saturday Utah 2015 - SP2013 Search Driven Sites
SharePoint Saturday Utah 2015 - SP2013 Search Driven SitesSharePoint Saturday Utah 2015 - SP2013 Search Driven Sites
SharePoint Saturday Utah 2015 - SP2013 Search Driven Sites
 

Similaire à Using JSLink and Display Templates to Customize List Views

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
 
Spsbe using js-linkanddisplaytemplates
Spsbe   using js-linkanddisplaytemplatesSpsbe   using js-linkanddisplaytemplates
Spsbe using js-linkanddisplaytemplatesPaul Hunt
 
JSLink for ITPros - SharePoint Saturday Jersey
JSLink for ITPros - SharePoint Saturday JerseyJSLink for ITPros - SharePoint Saturday Jersey
JSLink for ITPros - SharePoint Saturday JerseyPaul Hunt
 
Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013Mikael Svenson
 
SUG Bangalore - Overview of Sitecore Experience Accelerator with Pratik Satik...
SUG Bangalore - Overview of Sitecore Experience Accelerator with Pratik Satik...SUG Bangalore - Overview of Sitecore Experience Accelerator with Pratik Satik...
SUG Bangalore - Overview of Sitecore Experience Accelerator with Pratik Satik...Anindita Bhattacharya
 
Drew madelung sp designer workflows - sp-biz
Drew madelung   sp designer workflows - sp-bizDrew madelung   sp designer workflows - sp-biz
Drew madelung sp designer workflows - sp-bizDrew Madelung
 
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...SPTechCon
 
Custom Development for SharePoint
Custom Development for SharePointCustom Development for SharePoint
Custom Development for SharePointTalbott Crowell
 
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JSCross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JSThomas Daly
 
Spca2014 js link and display templates hatch
Spca2014 js link and display templates hatchSpca2014 js link and display templates hatch
Spca2014 js link and display templates hatchNCCOMMS
 
Building Responsive Intranet using Sharepoint Framework solutions - Asish Pad...
Building Responsive Intranet using Sharepoint Framework solutions - Asish Pad...Building Responsive Intranet using Sharepoint Framework solutions - Asish Pad...
Building Responsive Intranet using Sharepoint Framework solutions - Asish Pad...Asish Padhy
 
SharePoint 2013 Sandbox Solutions for On Premise or Office 365
SharePoint 2013 Sandbox Solutions for On Premise or Office 365SharePoint 2013 Sandbox Solutions for On Premise or Office 365
SharePoint 2013 Sandbox Solutions for On Premise or Office 365Ed Musters
 
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 optionsEric Overfield
 
Envision IT - Application Lifecycle Management for SharePoint in the Enterprise
Envision IT - Application Lifecycle Management for SharePoint in the EnterpriseEnvision IT - Application Lifecycle Management for SharePoint in the Enterprise
Envision IT - Application Lifecycle Management for SharePoint in the EnterpriseEnvision IT
 
Cross Site Collection Navigation
Cross Site Collection NavigationCross Site Collection Navigation
Cross Site Collection NavigationThomas Daly
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedGil Fink
 
Share point 2013 Building Websites
Share point 2013 Building WebsitesShare point 2013 Building Websites
Share point 2013 Building WebsitesSuhas R Satish
 
Session 1 branding and site development in SharePoint
Session 1   branding and site development in SharePointSession 1   branding and site development in SharePoint
Session 1 branding and site development in SharePointKhoa Quach
 

Similaire à Using JSLink and Display Templates to Customize List Views (20)

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
 
JSLink for ITPros - SharePoint Saturday Jersey
JSLink for ITPros - SharePoint Saturday JerseyJSLink for ITPros - SharePoint Saturday Jersey
JSLink for ITPros - SharePoint Saturday Jersey
 
SXA in action
SXA in actionSXA in action
SXA in action
 
Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013
 
SUG Bangalore - Overview of Sitecore Experience Accelerator with Pratik Satik...
SUG Bangalore - Overview of Sitecore Experience Accelerator with Pratik Satik...SUG Bangalore - Overview of Sitecore Experience Accelerator with Pratik Satik...
SUG Bangalore - Overview of Sitecore Experience Accelerator with Pratik Satik...
 
Drew madelung sp designer workflows - sp-biz
Drew madelung   sp designer workflows - sp-bizDrew madelung   sp designer workflows - sp-biz
Drew madelung sp designer workflows - sp-biz
 
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
 
Custom Development for SharePoint
Custom Development for SharePointCustom Development for SharePoint
Custom Development for SharePoint
 
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JSCross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
 
Spca2014 js link and display templates hatch
Spca2014 js link and display templates hatchSpca2014 js link and display templates hatch
Spca2014 js link and display templates hatch
 
Building Responsive Intranet using Sharepoint Framework solutions - Asish Pad...
Building Responsive Intranet using Sharepoint Framework solutions - Asish Pad...Building Responsive Intranet using Sharepoint Framework solutions - Asish Pad...
Building Responsive Intranet using Sharepoint Framework solutions - Asish Pad...
 
SharePoint 2013 Sandbox Solutions for On Premise or Office 365
SharePoint 2013 Sandbox Solutions for On Premise or Office 365SharePoint 2013 Sandbox Solutions for On Premise or Office 365
SharePoint 2013 Sandbox Solutions for On Premise or Office 365
 
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
 
Ui devopler
Ui devoplerUi devopler
Ui devopler
 
Envision IT - Application Lifecycle Management for SharePoint in the Enterprise
Envision IT - Application Lifecycle Management for SharePoint in the EnterpriseEnvision IT - Application Lifecycle Management for SharePoint in the Enterprise
Envision IT - Application Lifecycle Management for SharePoint in the Enterprise
 
Cross Site Collection Navigation
Cross Site Collection NavigationCross Site Collection Navigation
Cross Site Collection Navigation
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrived
 
Share point 2013 Building Websites
Share point 2013 Building WebsitesShare point 2013 Building Websites
Share point 2013 Building Websites
 
Session 1 branding and site development in SharePoint
Session 1   branding and site development in SharePointSession 1   branding and site development in SharePoint
Session 1 branding and site development in SharePoint
 

Plus de Paul Hunt

Exploring conditional access to content stored in Office 365 - SPS Helsinki
Exploring conditional access to content stored in Office 365 - SPS HelsinkiExploring conditional access to content stored in Office 365 - SPS Helsinki
Exploring conditional access to content stored in Office 365 - SPS HelsinkiPaul Hunt
 
Exploring conditional access to content stored in office 365 spsce
Exploring conditional access to content stored in office 365   spsceExploring conditional access to content stored in office 365   spsce
Exploring conditional access to content stored in office 365 spscePaul Hunt
 
Exploring conditional access to content stored in Office 365
Exploring conditional access to content stored in Office 365Exploring conditional access to content stored in Office 365
Exploring conditional access to content stored in Office 365Paul Hunt
 
What do you mean 90 days isnt enough
What do you mean 90 days isnt enoughWhat do you mean 90 days isnt enough
What do you mean 90 days isnt enoughPaul Hunt
 
Spsnl18 exploring identity management options in office 365
Spsnl18   exploring identity management options in office 365Spsnl18   exploring identity management options in office 365
Spsnl18 exploring identity management options in office 365Paul Hunt
 
Spunite exploring identity management options in office 365
Spunite   exploring identity management options in office 365Spunite   exploring identity management options in office 365
Spunite exploring identity management options in office 365Paul Hunt
 
Making auditing great again! Office 365
Making auditing great again! Office 365Making auditing great again! Office 365
Making auditing great again! Office 365Paul Hunt
 
#SPSLondon - Session 1 - Building an faq for end users
#SPSLondon - Session 1 - Building an faq for end users#SPSLondon - Session 1 - Building an faq for end users
#SPSLondon - Session 1 - Building an faq for end usersPaul Hunt
 
SPSBE building an faq for end users
SPSBE building an faq for end usersSPSBE building an faq for end users
SPSBE building an faq for end usersPaul Hunt
 
Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...
Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...
Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...Paul Hunt
 
Iw411 migrating content by search from 2010 into 2013 - minified
Iw411   migrating content by search from 2010 into 2013 - minifiedIw411   migrating content by search from 2010 into 2013 - minified
Iw411 migrating content by search from 2010 into 2013 - minifiedPaul Hunt
 

Plus de Paul Hunt (11)

Exploring conditional access to content stored in Office 365 - SPS Helsinki
Exploring conditional access to content stored in Office 365 - SPS HelsinkiExploring conditional access to content stored in Office 365 - SPS Helsinki
Exploring conditional access to content stored in Office 365 - SPS Helsinki
 
Exploring conditional access to content stored in office 365 spsce
Exploring conditional access to content stored in office 365   spsceExploring conditional access to content stored in office 365   spsce
Exploring conditional access to content stored in office 365 spsce
 
Exploring conditional access to content stored in Office 365
Exploring conditional access to content stored in Office 365Exploring conditional access to content stored in Office 365
Exploring conditional access to content stored in Office 365
 
What do you mean 90 days isnt enough
What do you mean 90 days isnt enoughWhat do you mean 90 days isnt enough
What do you mean 90 days isnt enough
 
Spsnl18 exploring identity management options in office 365
Spsnl18   exploring identity management options in office 365Spsnl18   exploring identity management options in office 365
Spsnl18 exploring identity management options in office 365
 
Spunite exploring identity management options in office 365
Spunite   exploring identity management options in office 365Spunite   exploring identity management options in office 365
Spunite exploring identity management options in office 365
 
Making auditing great again! Office 365
Making auditing great again! Office 365Making auditing great again! Office 365
Making auditing great again! Office 365
 
#SPSLondon - Session 1 - Building an faq for end users
#SPSLondon - Session 1 - Building an faq for end users#SPSLondon - Session 1 - Building an faq for end users
#SPSLondon - Session 1 - Building an faq for end users
 
SPSBE building an faq for end users
SPSBE building an faq for end usersSPSBE building an faq for end users
SPSBE building an faq for end users
 
Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...
Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...
Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...
 
Iw411 migrating content by search from 2010 into 2013 - minified
Iw411   migrating content by search from 2010 into 2013 - minifiedIw411   migrating content by search from 2010 into 2013 - minified
Iw411 migrating content by search from 2010 into 2013 - minified
 

Dernier

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 

Dernier (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 

Using JSLink and Display Templates to Customize List Views

  • 1. Using JSLink and Display Templates with List View Web Parts for ITPros #SPSSTHLM19 Paul Hunt (@cimares) January 25th, 2014 SharePoint Saturday Stockholm
  • 3. Who Am I? SharePoint Architect for Trinity Expert Systems • Co-organiser of SUGUK London Region • Member of the SharePoint community since 2007 • In my spare time I’m a woodturner, making Pots, Pens and artistic pieces! • • Paul Hunt • Twitter: @Cimares
  • 4. What is this session all about? • The List View Web Part
  • 5. Who’s this session for? • Primarily First/Second tier developers  ITPros who customised 2010 list views in SPD  ITPros that used to write their own XSLT in SP2010  Developers that want to know what's available before opening VS2012 • On Premises or Office 365 Deployments • Might not be ideal for someone who isn’t comfortable with JavaScript, HTML and CSS. – Though if you used to play in SPD 2010 you’re halfway there! – If you want to know what's achievable without deployed solutions
  • 6. What did we used to do? • We used SPD and the Design View  We did conditional formatting  Played with colours  Injected Hyperlinks
  • 7. What did we used to do? • But  No design view anymore!
  • 8. What did we used to do? • We used XSLT Overrides (Still exist, but deprecated!)
  • 9. What did we used to do? • We used XSLT Overrides (Still exist, but deprecated!)  Which took boring list data views
  • 10. What did we used to do? • We used XSLT Overrides (Still exist, but deprecated!)  And transformed them into engaging visual representations
  • 11. What did we used to do? • We used custom code solutions (We still can!)  Custom CAML Rendering Templates  Custom List Views  Custom Web Parts • All bring additional headaches
  • 12. So why the focus on Client Side Rendering?
  • 13. So why the focus on Client Side Rendering? • It’s client side, moving the impact of customisations off of the web server and onto the often powerful and under utilised client machine SETI@Home Folding@Home
  • 14. So why the focus on Client Side Rendering? • It’s client side, moving the impact of customisations off of the web server and onto the often powerful and under utilised client machine • Some client machines may struggle with heavy Javascript loads!
  • 15. Specifically why JavaScript, HTML and CSS? It’s easier to develop.. • Much simpler than XSLT • Certainly easier to troubleshoot than XSLT • Likely to have the skills in house • Cross-platform (ish!) •  Some frameworks such as jQuery help with this
  • 16. Exactly what is a JavaScript Display Template? A small piece of JavaScript code that is called by the browser AFTER the page has been delivered. • They are prolific in SharePoint 2013 •  Some examples  Search Results  Field Rendering  Search Refiners  List Forms  List views  eDiscovery
  • 17. LVWP Templates != Search Display Templates 17 LVWP Display Templates are JavaScript only. • They do not start life as HTML like Display Templates for search do. • They do not require embedded properties. • CONTEXT (ctx) is king! •
  • 18. We’re just looking at:• List View Display Templates  These provide the ability to override the rendering of an entire view • Field Rendering Display Templates  These provide the ability to override the rendering of a single field in a list view
  • 19. Anatomy of a List View Display Template Start with an empty .JS (Or copy my examples) • Define a Function to register the Display Template • Define the Function called by the Display Template for each item. • Call the register function •
  • 20. Anatomy of a List View Display Template • Define a Function to register the Display Template For a list of template types see - http://bit.ly/169AbS9
  • 21. Anatomy of a List View Display Template • Define the Function called by the Display Template • Note the use of ctx.CurrentItem.Title – Any field in the view can be obtained this way – You must use the internal name • Obtained from the edit column screen
  • 22. Anatomy of a List View Display Template • Call the function we defined when the page loads.
  • 23. Anatomy of a Field Rendering Display Template • All that really changes is the override set-up • This time there are no headers/footers • We only specify the Base View ID/Field Name
  • 24. Anatomy of a Field Rendering Display Template • The render function is similar to the list view
  • 25. How do we use them with List Views? • First we need to upload/create them in the MasterPage gallery
  • 26. How do we use them with List Views? • Set some metadata
  • 27. How do we use them with List Views? • Add a link into the JSLink on the web part • Note the ~token in use – – – – – ~sitecollection ~site ~layouts ~sitecollectionlayouts ~sitelayouts • You can have multiple JSLinks – Join them with |
  • 29. How do we troubleshoot? • IE Developers Toolbar (Other debuggers exist!)
  • 30. How do we troubleshoot? • Fiddler – HTTP Proxy
  • 31. How do we troubleshoot? • Fiddler – HTTP Proxy
  • 32. Troubleshooting in IE with the F12 Dashboard http://bit.ly/12kMPvr
  • 33. There has to be a catch? Minimal Download Strategy • Multiple list views on a page • Changing SharePoint functionality •
  • 34. There has to be a catch? • Minimal Download Strategy  Our display templates work on page load  But fail during a refresh.  This is because our JavaScript doesn’t get called a second time Two workarounds! • Turn off the Minimal Download Feature in each Web • • Include the relevant JavaScript in your Display Template code
  • 35. There has to be a catch? • Multiple list views on a page  Because of the way Display Templates are registered, it’s not possible to have two on the page if the list templates are the same. (E.g. Custom TemplateType = 100)  There is a workaround though published on my blog  http://bit.ly/136e0e3
  • 36. There has to be a catch? • Changing/Breaking SharePoint functionality  For example, overriding the Tasks view breaks SharePoint rendering.  This is fixed in the earlier Field demo with a couple of lines of JavaScript.
  • 37. Page lifecycle • SharePoint outputs JSLink in the Header of the page  This registers our Display Template
  • 38. Page lifecycle • SharePoint LVWP outputs the list data into the page  JSON Object Format
  • 39. Page lifecycle • And finally after setting things up  Calls the RenderListView() function for the web part. • Which in turn: – Calls the GetTemplates()
  • 40. Page lifecycle • Which compares the Context object to the list of registered overrides • And if everything is in place, our override wins the battle!
  • 43. Call to Action! • Take a look at these sites for more detailed info Wes Preston – JS Link a primer - http://bit.ly/102fcNa • Martin Hatch – JSLink 7 part series - http://bit.ly/Hh5zFk • My blog •  Solving the multiple list view issue - http://bit.ly/JSLinkIssues  Editing local JS files using fiddler - http://bit.ly/EditUsingFiddler 43
  • 44. Don’t forget SharePint! • SHARE·PINT: [SHAIR-PAHYNT] Noun 1. An assembly or meeting in relation to Microsoft SharePoint, accompanied with an alcoholic beverage.