sharepoint 2013 client-side rendering (csr) & jslink templates

26
SharePoint Saturday Gulf #SPSGulf Client Side Rendering in SharePoint 2013 (DeepDive) Muawiyah Shannak Our Sponsors:

Upload: muawiyah-shannak

Post on 08-May-2015

7.596 views

Category:

Technology


8 download

DESCRIPTION

In these slides we provides information about new technology (CSR) to learn you how to customize the way users interact with list data, and how to develop solutions that change the way data is rendered.

TRANSCRIPT

Page 1: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

SharePoint Saturday Gulf#SPSGulf

Client Side Rendering in SharePoint 2013

(DeepDive)Muawiyah Shannak

Our Sponsors:

Page 2: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

Twitter: @MuShannak

Blog: mushannak.blogspot.ae

LinkedIn: linkedin.com/in/shannak

Slideshare:

slideshare.net/MuawiyahShannak

Website: mushannak-

public.sharepoint.com

Muawiyah ShannakSharePoint Architect, MCC & UAE-SPUG

Leaders

Page 3: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

Agenda

• Introduction

• CSR Model

• Advantages

• Building CSR Template

Page 4: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

OOTB List forms and views

• Lists are a key, underlying feature of your SharePoint site

• Forms: A page that allows users to create, view, or edit an item in a list.• New• Edit• Display

• Views: A named collection of settings for querying and displaying items in a SharePoint list

Page 5: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

OOTB CapabilitiesDemo 1

Page 6: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

Customize SP 2013 forms & views

Asp.net InfoPath Custom Fields

Custom JavaScript XSLT CSR

Page 7: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

What is Client-side rendering (CSR)

Client-side rendering enables you to customize UI components by using JavaScript on the client as opposed to on the server.

Page 8: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

CSR ExamplesDemo 2

Page 9: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

Server Side Render

Request

HTML

Content DB

Server

Processing

Browser

Page 10: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

Client Side Render (CSR)

Request

JSON

Browser

Content DB

Server

Processing

JSON to HTML

Page 11: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

How it’s workDemo 3

Page 12: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

CSR advantages over other options

Single field, entire view or form

Flexibility

Rendering is performed on the client side.

Performance

Web developers will already be familiar with JavaScript

Ease of Development

Consistency with SharePoint OOTB views and forms

Consistency

Page 13: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

Build and Use CSR Template

Build

Create JSLink JavaScript files and define a template

Upload

Upload templates files to

SharePoint(system files or libraries)

Update the property

Update the JSLink property by using OOTB, PowerShell,

code or schema

Page 14: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

Build CSR Template

• Custom context variable

• Register the context

• Custom context variable

Field (internal name)

Display mode

Function return string (html) value

Page 15: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

CSR Field TemplatesDemo 4

Page 16: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

Where we can use CSR Templates

Override fields render in display,

edit and new forms.

Forms

Display Templates

Search Result

List View

• Fields

• Items

• Body

• Group

• View

• Header

• Footer

Page 17: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

CSR & List Views

Fields

Item

Body

Header

Footer

View

Page 18: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

CSR Item Template

Page 19: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

CSR Item TemplateDemo 5

Page 20: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

CSR & Forms

Fields

Page 21: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

OnPreRender and OnPostRender

• OnPreRender: The JavaScript event handler for the event that occurs immediately before the field is rendered to its containing place. Useful usage scenario: request more dilated data

• OnPostRender: The JavaScript event handler for the event that occurs immediately after complete the field HTML render. Useful usage scenario: applying JQuery UI transformation

Page 22: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

OnPostRenderDemo 6

Page 23: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

Link CSR files

PowerShellOOTB

Code (Client & Server API) CAML

Page 24: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

Link CSR files using PowerShell

Demo 6

Page 25: SharePoint 2013 Client-Side Rendering (CSR) & JSLink Templates

Samples

http://code.msdn.microsoft.com/office/Client-side-rendering-JS-2ed3538a