Tuesday, October 8, 2013

JS Link in SharePoint

JS Link is a property in web parts.You can customise the data to be displayed on the webpart with th help of javascript functions.

Create a JavaScript file and add the necessary functionality to your javascript functions

Upload the Javascript file into Master Page Gallery

Select the Web Part. Edit the web part properties. Select JS Link property and add the path of the javascript file.

Syntax to Customize a field type using client-side rendering


(function () {

    // Intialize the variables 
    var favoriteColorContext = {};
    overrideCtx.Templates = {};

    // Override columns data
    favoriteColorContext.Templates.Fields = {
           

}
    };
    
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(favoriteColorContext);


})();


A simple Example, Refer the link : http://msdn.microsoft.com/en-us/library/jj220061.aspx

No comments:

Post a Comment