12/22/2015

SharePoint JS Link Context Object Details

This article applies to SharePoint 2013, 2016 and SharePoint Online.

This article is a work in progress!

 

It seems I’ve been writing a lot of JS Link lately and I’m always playing a guessing game with the data available via the “context” parameter. If you know where to look, you can find this info right in the page! Just because you can find it does not mean you know what it is or how to use it. This article is my collection of notes “so far”. I will be back to update as I have time and learn more!

 

Context

Each of the functions you write for JS Link will be passed a “context” object as a parameter. From this object you can retrieve properties about the current list, current list item and other objects. In the rest of the article are examples of the data returned from the context object.

There are several child context objects that you may be working with: (documented below)

  • Context.CurrentItem for a list item
  • Context.CurrentItem.somefile (results vary based on field type)
  • Context.CurrentItem.AssignedTo
  • Context.CurrentFieldSchema
  • Context.ListData  <—This represents the rows of data in the web part.
  • Context.ListSchema
  • Context.ListSchema.PropertyBag
  • Context.Templates
  • Context.Templates.Fields
  • Context.BasePermissions

By context, I am referring to the object passed in to a JavaScript function registered by SPClientTemplates.TemplateManager.RegisterTemplateOverrides and not the object passed to RegisterTemplateOverrides. (Too many JS Link code examples on the web name the object passed to RegisterTemplateOverrides as “ctx”, “context” or other names that imply context.)

(function () { 

  // do all of the setup work...
  var overrides = {};
  overrides.Templates = {}; 

  // define the web part view
  overrides.Templates.Header = "<b>Cool Web Part</b> <ul>";
  overrides.Templates.Footer = "</ul> Check back for updates!";
  overrides.Templates.Item =
function(ctx) {return "<li>" + ctx.CurrentItem.Title + "</li>"}; // register the override SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrides); })();

 

 

List Data

JS Link passes the context data as a parameter to your functions. When working with other JavaScript code you often need to access data about the web parts on the page. In SharePoint 2013, 2016 and SharePoint Online, metadata about the content of list web parts is embedded in the page’s JavaScript as JSON data. This data is preloaded into variables with names based on the web part names. Examples: WPQ3ListData, WPQ4ListData, etc. You can access these variables directly, or use ListData property of the “context” variable passed into JS Link functions.

To discover the metadata about a list, i.e. the Title, URL, etc., search for “new ContextInfo”. 

Ways of finding the list items data:

  • In your browser visit the list or library page and use the browser’s View Source feature to see the JSON formatted data that describes the list and list data. Search for “ListData =”.
  • Use the F12 Tools to access the global ListData variables:  WPQ3ListData, WPQ4ListData, etc.
  • Run some custom JavaScript to dump the context objects as nice HTML tables.

 

Using View Source

An example of the View Source where I searched for “ListData” and found the fields in the ListData section for one of the web parts in the page:

image

 

The View Source approach is a quick way to discover:

  • The internal names of fields. For example, you can’t find “% complete” here but you can find “PercentComplete”.
  • That some items are simple data types and some are collections or objects that require extra work to access.
    clip_image002
    To access the Priority property all you need to use is ctx.CurrentItem.Priority. To access AssignedTo you won’t be able to just use ctx.CurrentItem.AssignedTo. Note the square bracket (“[“) in the data. This indicates that this is a collection of objects, so at a minimum you will need to use ctx.CurrentItem.AssignedTo[0] to retrieve the first object. Also note the curly brackets (“{“) that indicate an object. To use this data you will need to specify the object’s property like this: ctx.CurrentItem.AssignedTo[0].title.

 

 

The Context Object

This list has the sample results from a context object for a task list. (Comments in blue.) Note that many of the properties are themselves objects or collections objects.

Property

Value

library only

listBaseType

0

 

listTemplate

171

This is the template ID or the Registration ID for the template used to create the list. 171 is for “Tasks (2013 version)”. For a list of IDs see: http://techtrainingnotes.blogspot.com/2015/02/sharepoint-2013-list-and-library.html

 

listName

{E7ADB1A8-5C1C-437F-B946-369431601856}

GUID. Unique ID for the list.

 

view

{437CC0EA-EC27-4AE9-AD44-70762F4DF28E}

GUID. Unique ID for the list.

 

listUrlDir

/sites/yourSite/Lists/Tasks

URL to the list.

 

HttpPath

https://yourDomain.com/sites/yourSite/_vti_bin/owssvr.dll?CS=65001

URL to the OWSSVR.dll remote procedure call. Returns XML. Example: https://yourDomain.com/sites/yourSite/_vti_bin/owssvr.dll?CS=65001&Cmd=Display&List={BD415E20-AC5F-41DA-BAC9-F054C4764A2}

 

HttpRoot

https://yourDomain.com/sites/yourSite

URL to the site (SPWeb) that contains the list.

 

serverUrl

null

 

imagesPath

/_layouts/15/images/

Server folder for icons and images.

 

PortalUrl

null

 

RecycleBinEnabled

1

 

enteringGridMode

false

 

inGridMode

false

 

isWebEditorPreview

0

 

rootFolderForDisplay

null

 

isPortalTemplate

null

 

isModerated

false

 

recursiveView

false

 

displayFormUrl

https://yourDomain.com/sites/yourSite/_layouts/15/listform.aspx?PageType=4&ListId=%7BE7ADB1A8%2D5C1C%2D437F%2DB946%2D369431601856%7D

Link to the View Item form. (.ASPX or InfoPath form)

 

editFormUrl

https://yourDomain.com/sites/yourSite/_layouts/15/listform.aspx?PageType=6&ListId=%7BE7ADB1A8%2D5C1C%2D437F%2DB946%2D369431601856%7D

Link to the Edit Item form. (.ASPX or InfoPath form)

 

newFormUrl

https://yourDomain.com/sites/yourSite/_layouts/15/listform.aspx?PageType=8&ListId=%7BE7ADB1A8%2D5C1C%2D437F%2DB946%2D369431601856%7D&RootFolder=

Link to the New Item form. (.ASPX or InfoPath form)

 

ctxId

27

 

CurrentUserId

9

This is the Site Collection ID of the user and will be different in each Site Collection.

 

isForceCheckout

false

 

EnableMinorVersions

false

 

ModerationStatus

0

 

verEnabled

0

 

isVersions

0

 

WorkflowsAssociated

false

 

ExternalDataList

false

 

HasRelatedCascadeLists

1

 

CascadeDeleteWarningMessage

null

 

ContentTypesEnabled

true

 

SendToLocationName

 

 

SendToLocationUrl

 

 

StateInitDone

false

 

TotalListItems

null

 

CurrentSelectedItems

null

 

LastSelectableRowIdx

null

 

SelectAllCbx

null

 

TableCbxFocusHandler

null

 

TableMouseoverHandler

null

 

onItemSelectionChangedHandlers

 

 

wpq

WPQ2

This is part of the web part’s name (“WebPartWPQ2”) and prefix for other related variables such as WPQ2ListData and WPQ2SchemaData.

 

Templates

[object Object]

See “Context.Templates” below.

 

ListData

[object Object]

See “Context.ListData” below.

ctx.ListData[idOfCurrentItem] is the same as ctx.CurrentItem.

 

ListSchema

[object Object]

See “Context.ListSchema” below.

 

BaseViewID

1

 

ListTemplateType

171

This is the template ID or the Registration ID for the template used to create the list. 171 is for “Tasks (2013 version)”. For a list of IDs see: http://techtrainingnotes.blogspot.com/2015/02/sharepoint-2013-list-and-library.html

 

existingServerFilterHash

undefined

 

noGroupCollapse

true

Only present if view Grouping is enabled and “By default, show groupings” is set to “Collapsed”.

 

NavigateForFormsPages

true

 

BasePermissions

[object Object]     

See Context.BasePermissions below.

 

CurrentUserIsSiteAdmin

true

 

IsAppWeb

false

 

AllowGridMode

true

 

rootFolder

 

 

viewTitle

All Tasks

Title of the current view.

 

NoScriptEnabled

false

 

OfficialFileName

 

 

OfficialFileNames

 

 

WriteSecurity

1

 

SiteTitle

JS Link Demo 1

 

ListTitle

Tasks

 

isXslView

true

 

IsClientRendering

true

 

RegionalSettingsTimeZoneBias

300

Contains the bias, in minutes, that a time zone differs from Coordinated Universal Time (UTC), or the bias, in minutes, that standard time or daylight saving time for a time zone differs from UTC. 

 

NewWOPIDocumentEnabled

True

Lib

NewWOPIDocumentUrl

/sites/yourSite/_layouts/15/CreateNewDocument.aspx?SaveLocation=%2Fsites%2FyourSite%2FShared%20Documents&DefaultItemOpen=1

Lib

AllowCreateFolder

true

Lib

SiteTemplateId

1

 

bInitialRender

true

 

ListDataJSONItemsKey

Row

 

ControlMode

4

 

SiteClientTag

0$$16.0.4622.1221

 

CurrentLanguage

1033

Locale IDs Assigned by Microsoft. 1033 = US English. See: https://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

 

CurrentCultureName

en-US

 

CurrentUICultureName

en-US

 

OnPreRender


JS Link function defined for current web part.

 

OnPostRender

function(){var a=document.getElementById("cbxSelectAllItems"+b.ctxId),c="ontouchstart"in document.documentElement&&!IsSupportedChromeOnWin()?"touchstart":"click";$addHandler(a,c,function(){a.checked=!a.checked;if(ListModule.Settings.SupportsItemSelection){WriteDocEngagementLog("Documents_SelectAllClick","OneDrive_SelectAllClick");ToggleAllItems(c,a,b.ctxId)}})},function(){setTimeout(j,0)}

JS Link function defined for current web part. The above example is a “default” function.

 

canDragUpload

true

 

RenderView

function g(a){return b(a,"View")}

 

RenderHeader

function l(a){return b(a,"Header")}

 

RenderBody

function n(a){return b(a,"Body")}

 

RenderFooter

function j(a){return b(a,"Footer")}

 

RenderGroups

function k(a){if(a==null||a.ListData==null)return"";var b=null;if(a.Templates!=null)b=a.Templates.Group;var k=a.ListData,j=k[f(a)],h="";if(j==null){if(typeof b=="string"||typeof b=="function"){a.CurrentGroupIdx=0;a.CurrentGroup=k;a.CurrentItems=k[c(a)];h+=CoreRender(b,a);a.CurrentItems=null;a.CurrentGroup=null}return h}for(var i=0;i<j.length;i++){var g=j[i],e=d(a,g,"Group");if(e==null||e==""){if(b==null||b=={})return"";if(typeof b=="string"||typeof b=="function")e=b;if(e==null||e==""){var l=g.GroupType;e=b[l]}}if(e==null||e=="")continue;a.CurrentGroupIdx=i;a.CurrentGroup=g;a.CurrentItems=g[c(a)];h+=CoreRender(e,a);a.CurrentGroup=null;a.CurrentItems=null}return h}

 

RenderItems

function m(a){if(a==null||a.ListData==null)return"";var g=null;if(a.Templates!=null)g=a.Templates.Item;var p=a.ListData,e=a.CurrentItems;if(e==null)e=typeof a.CurrentGroup!="undefined"?a.CurrentGroup[c(a)]:null;if(e==null){var l=p[f(a)];e=typeof l!="undefined"?l[c(a)]:null}if(e==null)return"";for(var j="",h=0;h<e.length;h++){var i=e[h],b=d(a,i,"Item");if(b==null||b==""){if(g==null||g=={})return"";if(typeof g=="string"||typeof g=="function")b=g;if(b==null||b==""){var o=i.ContentType;b=g[o]}}if(b==null||b=="")continue;a.CurrentItemIdx=h;a.CurrentItem=i;if(typeof a.ItemRenderWrapper=="string")a.ItemRenderWrapper==SPClientRenderer.ParseTemplateString(a.ItemRenderWrapper,a);if(typeof a.ItemRenderWrapper=="function"){var k=a.ItemRenderWrapper,m={TemplateFunction:k,Operation:"ItemRenderWrapper"},n=function(){return k(CoreRender(b,a),a,b)};j+=CallFunctionWithErrorHandling(n,a,"",m)}else j+=CoreRender(b,a);a.CurrentItem=null}return j}

 

RenderFields

function i(a){if(a==null||a.Templates==null||a.ListSchema==null||a.ListData==null)return"";var f=a.CurrentItem,b=a.ListSchema.Field,d=a.Templates.Fields;if(f==null||b==null||d==null)return"";var c="";for(var g in b)c+=e(a,b[g]);return c}

 

RenderFieldByName

function h(a,c){if(a==null||a.Templates==null||a.ListSchema==null||a.ListData==null||c==null||c=="")return"";var d=a.CurrentItem,b=a.ListSchema.Field,g=a.Templates.Fields;if(d==null||b==null||g==null)return"";if(typeof SPClientTemplates!="undefined"&&spMgr!=null&&a.ControlMode==SPClientTemplates.ClientControlMode.View)return spMgr.RenderFieldByName(a,c,d,a.ListSchema);for(var f in b)if(b[f].Name==c)return e(a,b[f]);return""}

 

heroId

idHomePageNewItem

 

CurrentItem

[object Object]

See “Context.CurrentItem” below.

 

CurrentItemIdx

0

 

CurrentFieldSchema

[object Object]

See “Context.FieldSchema” below.

 

allowedSuiteExtensionFileTypes

bmp,chm,gif,htm,html,jpeg,jpg,pdf,png,psd,tif,txt,wma,wmv,xml,zip

Lib

 

 

Context.CurrentItem

These properties are retrieved from the CurrentItem property of the Context. This example is for a Task list. Properties unique to a task list are marked “(Task list field.)”.

 

Property

Value

outlineLevel

1

For task lists. Top level task = 1. First child = 2, etc.

ID

5

Internal generated list item ID. Starts at 1. This is the ID column in a view.

PermMask

0x7fffffffffffffff

Permissions Mask. See https://msdn.microsoft.com/en-us/library/cc704409.aspx and http://sympmarc.com/2009/02/03/permmask-in-sharepoint-dvwps/

FSObjType

0

ContentType

Task

Also see ContentTypeId below.

Checkmark

No

PercentComplete

45.5 %  

(Task list field.)

Returns a string with a percent sign.

PercentComplete.

0.455000000000000 

(Task list field.)

Returns a number between 0 and 1.

Due the the “.” in the property name you will need to use the index notation to retrieve this: ctx.CurrentItem['PercentComplete.'].

Title

Task99

List/library item title.

FileLeafRef

5_.000                  Mydocument.docx

Name in path for item. (File name for library documents.)

Created_x0020_Date.ifnew

Returns “1” if the “New” icon should be displayed.

FileRef

/sites/demosite/Lists/Tasks/5_.000
/sites/demosite/Documents/Mydocument.docx

Relative path to item.

File_x0020_Type

docx

File extension for library item.

File_x0020_Type.mapapp

undefined

HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon

 

HTML_x0020_File_x0020_Type.File_x0020_Type.mapico

 

ContentTypeId

0x0108001C2144D361847C438854B157E203AB3E

DueDate


(Task list field.)

DueDate.FriendlyDisplay

undefined

(Task list field.)

See “Modified.FriendlyDisplay”.)

AssignedTo

[object Object]

Returns a collection of users, even if only one. You will need to index the collection. “ctx.CurrentItem.AssignedTo[0]” See Context.CurrentItem.AssignedTo below.

Priority

(2) Normal

(Task list field.)

Status

Not Started

(Task list field.)

Modified

11/18/2015 6:47 PM

Modified.FriendlyDisplay

undefined

Due the the “.” in the property name you will need to use the index notation to retrieve this: ctx.CurrentItem['Modified.FriendlyDisplay']. This property only returns “codes” that represent friendly dates. Display the date using GetRelativeDateTimeString(ctx.CurrentItem["Modified.FriendlyDisplay"]) to display “4 minutes ago” (instead of “1|0|3|5”) or “October 26” (instead of “0|October 26”).

_ModerationStatus

Pending

Content Approval text value of status. Property is only available if Content Approval is enabled. 

_ModerationStatus.

2

Content Approval numeric value of status. Property is only available if Content Approval is enabled. Approved=0, Rejected=1, Pending=2. Due to the “.” in the name you will need to use indexer access:  ctx.CurrentItem[“_ModerationStatus.”]

firstRow

true

Returns “true” for the first row, otherwise returns “undefined”. 

 

Context.CurrentItem.field for a Most Columns

For most columns the data is just returned as a string. Example: ctx.CurrentItem.Modified.

 

Context.CurrentItem.field for a Hyperlink Columns

Hyperlink columns are represented by two fields: fieldname and fieldname.desc Example: ctx.CurrentItem.ProductPicture and ctx.CurrentItem["ProductPicture.desc"] (Note that fields with dots must be accessed with using index notation.)

 

Context.CurrentItem.field for a Lookup Column

Lookup columns are returned as a collection of objects. (It may be a multiple choice column.) It must be accessed using an indexer: ctx.CurrentItem.TestLookup[0].

Property

Value

lookupId

2

lookupValue

Sales Department

isSecretFieldValue

false

 

Context.CurrentItem.field for a Managed Metadata Column

Managed Metadata columns are returned as objects. Example: ctx.CurrentItem.ToyCategory.Label

Property

Value

__type

TaxonomyFieldValue:#Microsoft.SharePoint.Taxonomy

Label

Boats

TermID

6eb29e02-8be0-4544-b2a7-d5d9fb2ea4f2

 

 

Context.CurrentItem (for the document library item)

 

Property

Value

ID

1

PermMask

0x7fffffffffffffff

Permissions Mask. See https://msdn.microsoft.com/en-us/library/cc704409.aspx and http://sympmarc.com/2009/02/03/permmask-in-sharepoint-dvwps/

FSObjType

0

HTML_x0020_File_x0020_Type

 

UniqueId

{AE945D21-B2CD-4C32-A7E4-B45D51C45F0D}

ProgId

 

File_x0020_Type

xlsx

File_x0020_Type.mapapp

undefined

HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon

(Returns the object used to open a document in Office. “SharePoint.OpenDocuments”)

HTML_x0020_File_x0020_Type.File_x0020_Type.mapico

(Returns the icon for the file type. Example: icdocx.png)

serverurl.progid

(Example: 1https://yourDomain.com/sites/yourSite/Shared Documents/Event budget.xlsx?d=wae945d21b2cd4c32a7e4b45d51c45f0d )

ServerRedirectedEmbedUrl

https://yourDomain.com/sites/yourSite/_layouts/15/WopiFrame.aspx?sourcedoc={ae945d21-b2cd-4c32-a7e4-b45d51c45f0d}&action=interactivepreview

File_x0020_Type.progid

undefined

File_x0020_Type.url

undefined

FileRef

/sites/yourSite/Shared Documents/Event budget.xlsx

Relative path to the file.

FileLeafRef

Event budget.xlsx

Name in path for item. (File name for library documents.)

CheckoutUser

 

CheckedOutUserId

 

IsCheckedoutToLocal

0

Created_x0020_Date.ifnew

(Returns “1” if the “New” icon should be displayed)

ContentTypeId

0x010100DE3AED5D38F22748B9EA70FF971BAAB7

Modified

11/16/2015 7:56 PM

Modified.FriendlyDisplay

undefined

Editor

[object Object]

Title

This is the title for the budget file

Title property

firstRow

true

Returns “true” for the first row, otherwise returns “undefined”. 

 

Context.CurrentItem.AssignedTo

This is a collection. You will need to access using an indexer. Example ctx.CurrentItem.AssignedTo[0]. To retrieve a user property: ctx.CurrentItem.AssignedTo[0].title

Property

Value

 

id

12

This is the Site Collection ID of the user and will be different in each Site Collection.

value

Sam Conklin

title

Sam Conklin

email

samc@microsmith.onmicrosoft.com

sip

samc@microsmith.onmicrosoft.com

picture

https://microsmith-my.sharepoint.com:443/User%20Photos/Profile%20Pictures/samc_microsmith_onmicrosoft_com_MThumb.jpg

jobTitle

IT Manager

department

IT

 

 

 

Context.CurrentFieldSchema

This example is for the Modified date column and is not currently a complete list.

Property

Value

Name

Modified

FieldType

DateTime

RealFieldName

Modified

DisplayName

Modified

ID

28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f

ReadOnly

TRUE

“ReadOnly” is only in the property list when the field is read only. I.e., you will not see “ReadOnly=FALSE”.

role

DateTime

ariaLabel

Modified

Type

DateTime

AllowGridEditing

FALSE

“AllowGridEditing” is only in the property list when the value is FALSE.

counter

3

FieldTitle

Modified

css

ms-cellstyle ms-vb2

fieldRenderer

your custom JS Link code is here

 

 

Context.ListData

Property

Value

Row

[object Object]

FirstRow

1

FolderPermissions

0x7fffffffffffffff

LastRow

1

FilterLink

?

ForceNoHierarchy

 

HierarchyHasIndention

 

 

Context.ListSchema

Property

Value

 

Field

[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]  (one object per field.)

 

LCID

1033

Locale IDs Assigned by Microsoft. 1033 = US English. See: https://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

 

Userid

9

 

PagePath

/sites/yourSite/Lists/Tasks/AllItems.aspx

 

ShowWebPart

 

 

View

{437CC0EA-EC27-4AE9-AD44-70762F4DF28E}

 

RootFolderParam

View={437cc0ea-ec27-4ae9-ad44-70762f4df28e}&

 

FieldSortParam

 

 

HttpVDir

https://yourDomain.com/sites/yourSite

 

IsDocLib

 

 

UIVersion

15

 

NoListItem

There are no items to show in this view of the "Tasks" list.

 

NoListItemHowTo

To add a new item, click "New".

 

DefaultItemOpen

1

 

ForceCheckout

0

 

Direction

none

 

UseParentHierarchy

1

List

ParentHierarchyDisplayField

LinkTitle

List

TabularView

1

 

EffectivePresenceEnabled

1

 

PresenceAlt

No presence information

 

UserDispUrl

/sites/yourSite/_layouts/15/userdisp.aspx

 

SelectedID

-1

 

ListRight_AddListItems

1

 

FolderRight_AddListItems

1

 

InplaceSearchEnabled

1

 

HasTitle

1

Lib

StrikeThroughOnCompletedEnabled

1

List

RenderViewSelectorPivotMenu

True

 

ViewSelectorPivotMenuOptions

JSON representing the view selector menu

 

RenderSaveAsNewViewButton

True

 

Toolbar

Standard

 

PropertyBag

[object Object]

List

 

Context.ListSchema.PropertyBag 

(This is empty in a document library and is likely to be different for each list/library type.)

Property

Value

vti_hassubdirs

true

vti_listbasetype

0

vti_listrequirecheckout

false

vti_dirlateststamp

11/18/2015 11:59:25 PM

vti_replid

rid:{313BBBC4-BF57-4406-B24B-23B089C0217A}

vti_rtag

rt:313BBBC4-BF57-4406-B24B-23B089C0217A@00000000256

vti_isbrowsable

true

vti_listservertemplate

171

This is the template ID or the Registration ID for the template used to create the list. 171 is for “Tasks (2013 version)”. For a list of IDs see: http://techtrainingnotes.blogspot.com/2015/02/sharepoint-2013-list-and-library.html

vti_docstoretype

1

vti_listenableminorversions

false

vti_level

1

vti_isscriptable

false

vti_isexecutable

false

vti_docstoreversion

256

vti_listenablemoderation

false

vti_foldersubfolderitemcount

0

vti_listtitle

Tasks

vti_metainfoversion

1

vti_folderitemcount

1

vti_timelastmodified

11/18/2015 11:47:55 PM

vti_nexttolasttimemodified

11/18/2015 11:47:38 PM

vti_parentid

{415EA0AD-179C-4267-A90D-1BC43E9EB261}

vti_candeleteversion

true

vti_listenableversioning

false

vti_listname

{E7ADB1A8-5C1C-437F-B946-369431601856}

vti_etag

"{313BBBC4-BF57-4406-B24B-23B089C0217A},256"

vti_timecreated

11/17/2015 12:37:02 AM

 

 

Context.Templates

Property

Value

 

View

function RenderViewTemplate(a){var b=a.RenderHeader(a);b+=a.RenderBody(a);b+=a.RenderFooter(a);return b}

Header

function(b,e){  … lots of code here … }

Body

function(a){  … lots of code here … }

Footer

 

Group

function RenderItemTemplateDefault(a){return a!=null&&typeof a.RenderItems=="function"?a.RenderItems(a):""}

Item

function RenderFieldTemplateDefault(a){return a!=null&&typeof a.RenderFields=="function"?a.RenderFields(a):""}

Fields

[object Object]   (See Context.Templates.Fields below.) 

 

Context.Templates.Fields

This is a property of Context.Templates. The actual properties return depend on your list. The following is for a task list.

Property

Value

Checkmark

function RenderFieldValueDefault(a){return a!=null&&a.CurrentFieldValue!=null?a.CurrentFieldValue.toString():""}

LinkTitle

function RenderFieldValueDefault(a){return a!=null&&a.CurrentFieldValue!=null?a.CurrentFieldValue.toString():""}

DueDate

function RenderFieldValueDefault(a){return a!=null&&a.CurrentFieldValue!=null?a.CurrentFieldValue.toString():""}

AssignedTo

function RenderFieldValueDefault(a){return a!=null&&a.CurrentFieldValue!=null?a.CurrentFieldValue.toString():""}

PercentComplete

function percentComplete(ctx) { var x = ctx.CurrentItem[ctx.CurrentFieldSchema.Name].replace(" ",""); return '<div class="ms-progress-meter"><div class="ms-progress-meter-inner" style="width: ' + x +';"></div></div>' }    ß This is an example of a custom JS Link template in use.

Priority

function RenderFieldValueDefault(a){return a!=null&&a.CurrentFieldValue!=null?a.CurrentFieldValue.toString():""}

Status

function RenderFieldValueDefault(a){return a!=null&&a.CurrentFieldValue!=null?a.CurrentFieldValue.toString():""}

Modified

function RenderFieldValueDefault(a){return a!=null&&a.CurrentFieldValue!=null?a.CurrentFieldValue.toString():""}

 

Context.BasePermissions

This is a property of the Context object.

Property

Value

ManageLists

true

ManagePersonalViews

true

OpenItems

true

 

 

.

No comments:

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.