Disable Quick editing and Select Item(Checkmarks) in SharePoint 2013

Disable Quick Editing -

Quick Edit is the Option in Lists which when selected can set your current View in the Edit mode or Datasheet mode for editing List Items.

edit this list

To remove the “edit this list” simply click on List tab and select List Settings.

List Settings

Next Select Advanced settings in List Settings.

Advanced Settings

In Quick Edit select “No” in ‘Allow items in this list to be edited using Quick Edit?’

Quick Edit

Resulting List
Result

Disable Selection or Checkmarks -

To Remove the Check marks that Selects an Item in a Listview Webpart - This can simply be done by a unchecking “Allow individual item checkboxes” in the current View of the Listview Webpart. Just to be clear we are talking about checkmarks in the below screen



To disable or Remove them you need to Modify the Current View by selecting “Modify View” in the ribbon or “Current View” in Edit Webpart properties.

Click on Modify View in “Library” tab in the Ribbon.


In the View towards middle expand “Tabular View” and uncheck Checkbox next to “Allow individual item checkboxes”.


SharePoint 2013 Display Template Tutorial

Display templates in SharePoint Server 2013 are templates used in Web Parts that use search technology (referred to in this article as Search Web Parts) to show the results of a query made to the search index. Display templates control which managed properties are shown in the search results, and how they appear in the Web Part.

Each display template is made of two files: HTML version of the display template that you can edit in your HTML editor, and a .js file that SharePoint uses.

When you create a display template by copying the HTML file for an existing display template in the Display Templates folder in the Master Page Gallery:

 * A .js file that has the same name is created in the location where you copied the HTML file.
 * All markup required by SharePoint Server 2013 is added to the .js file so that the display template displays correctly.

  * The HTML file and the .js file are associated, so that any later edits to the HTML file are synched to the .js file when the HTML file is saved.

Please Note : The syncing goes in one direction only. Changes to the HTML display template are synched to the associated .js file.

There are two primary types of Display Templates -

   * Control templates determine the overall structure of how the results are presented. Includes lists, lists with paging, and slide shows.
   * Item templates determine how each result in the set is displayed. Includes images, text, video, and other items.

The HTML file -
The HTML file that is used for a display template is a fully-formed HTML document, but it does not represent a full HTML webpage. SharePoint converts the pieces of the display template HTML file into JavaScript. This section describes the four major sections of a display template.

Title tag - The text in the <title> tag in a display template file is used as the display name in the Display Templates section of the Web Part edit pane when the Search Web Part is in edit mode.

Header properties -

Immediately after the title tag, there is a set of custom elements bounded by the following markup.
<pre><span style="color: green;"><!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
…
</mso:CustomDocumentProperties>
</xml><![endif]</title>

These elements and their properties provide important information to the SharePoint environment about the display template.


Users can Upload Pictures in SharePoint 2013 with "Image with formatting and constraints for publishing” column

Image Rendition is a new Feature in SharePoint 2013 with which users can re-size Images to a fix pre-defined Image Template and use them in WebParts or on a SharePoint Page. A perfect example when a user want to use fixed size Images is when they want to add an Image in a Blog Posts or in an Announcement Body. The Images in this case should be of fixed size to adhere to the rules of the desired formatting.

To Create a Column in a Document Library or a List that allows end-users to Choose Images from a SharePoint Library (like Images or Site Asserts) along with the required Image Rendition, we need to first Create a Site Column of type “Image with formatting and constraints for publishing” in our SharePoint site. The SharePoint Site should be either Created from a Publishing Template or has Publishing Feature enabled. Lets look the Steps to Create Such a Column and use it with one of the Image Rendition in Announcements Library.

Steps -
1. Navigate to Site Columns in Site Settings under ‘Web Designer Galleries’.
SharePoint 2013 Site Columns

2. On Site Columns page, Click on “Create” button.
SharePoint 2013 Create Site Column

3. Create a Site Column of type “Image with formatting and constraints for publishing” and add it into a Custom Site Column Group.
SharePoint 2013 Announcements Image
4. Once the Site Column is added it should be displayed under ‘Custom Columns’ group.
SharePoint 2013 Announcements Site Column
5. Next add this Site Column in your Document Library or List.For this example we will add it to an Announcements Library. Navigate to the List Settings of an Announcements Library and select ‘Add from existing site columns’.
SharePoint 2013 Add from existing Site columns
6. Select the new “Announcements Image” Site Column that we Created above.
SharePoint 2013 New Site Columns
7. Once done Create a new Item to see Announcements Image Site Column.
SharePoint 2013 Site Column
Click on ‘Click here to insert a picture from SharePoint.’ to add a new Picture.
8. In the Image Properties Popup select the Image from one of the SharePoint Libraries and select Image rendition. See the screen below.
SharePoint 2013 Image Rendition
9. Once you are done, you can notice all the Images are uploaded with the size that was Chosen in Image Rendition Display Template.


Create a new Wiki Page Content Type in SharePoint 2013

This new Wiki Page Layout can be set as default for Creating Wiki Pages in a Wiki Site.

Lets look at the Steps to Create a new Custom Wiki Page Layout and set it as a default for Creating Wiki Pages in a Wiki Site.

1. Create a Custom Wiki Page Layout – To Do this first navigate to Site Settings (settings wheel) -> Design Manager.

SharePoint 2013 Design Manager

2. In Design Manager select “6. Edit Page Layouts” and then “Create a page layout”

SharePoint 2013 Create Layout Page

3. Next in “Create a Page Layout” popup add a name of the new Custom Layout Page and Select Master Page that you are using on the site. Select “Enterprise Wiki Page” as the Parent Content Type and click Ok.

SharePoint 2013 Create New Layout Page

Once the Layout page is Created it gets added in Design Manager and Master Page gallery as a Draft Version.See below
SharePoint 2013 Custom Wiki Page Layout

Since this new Layout is inheriting fields form Enterprise Wiki Page, it still has Rating & Categories added to it.

4. Next to Remove Page Rating & Categories from the new Wiki Page type Layout that we just created, navigate to the Master Page gallery of your site.

5. In SharePoint 2013 by default, for each Page Layout, two files – .aspx and html are Created (see below).

SharePoint 2013 Layout Pages

If you need to make any Changes to the Layout, you need to download the .html file of your layout page and make Changes to it.
In our case since we want to remove the Page Rating and Categories Control we will download the .html file of our new Page layout to remove the unwanted controls from it.

To Download the html file (in the master page gallery) select the ECB menu of your Custom Layout page’s html and Download a Copy. See screen below

SharePoint 2013 Download as Copy

6. Once you have downloaded the Page Open it in a Notepad and look for the “Rating” div. Select and remove Divs that you do not need. See the selected divs as you see in the screen below and delete them.

SharePoint 2013 Custom PageLayout

Once done editing save and upload the notepad (html file) in the master page gallery.

7. Lastly, publish the Html Page to make it available for the sites to use. See screen below.

SharePoint 2013 Publish as Major Version

The new Layout is ready to be used but to make it available in the Wiki Site, we need to add it in allowed Page Layouts in “Page layouts and site templates” in the Wiki Site’s Site settings.

8. Navigate to the Wiki Site -> Site Settings. Select “Page layouts and site templates” under Look and Feel.
SharePoint 2013 Page layouts and site templates

9. In “Page layouts and site templates” page under “Page Layouts” section the select the newly Created Wiki Layout and add it to the box on the right under “Pages in this site can only use the following layouts:”. You can also set this a default layout for when you Create wiki page using “Add a Page” in site Setting menu. See below.

SharePoint 2013 Page Layout & default Page SharePoint 2013

Once your are done save the settings.

10. Finally, test the new Layout by Creating a new Wiki page using “Add a Page” from the Settings menu (see screen below). The new Wiki Page should be Created Without ratings & categories on the right.
SharePoint 2013 Add a Page

SharePoint 2013 Page name

New Wiki Page -
SharePoint 2013 Wiki Page Without Ratings


Members can add, edit and delete lists in SharePoint 2013

Members can add, edit and delete lists in SharePoint 2013 -

At some point, as a SharePoint Site Admin, you must have added users into the default “Members” group of your SharePoint site.As seen in earlier SharePoint Versions, this “Members” group (that gets Created with your Site) by default, has Contribute Permission level assigned to it. Typically, the Contribute permission level provides users added to the Members group with “view, add, update, and delete list items and documents” capabilities. This is all right because in the normal SharePoint world this is what we expect Site Members to do – but only in earlier SharePoint Versions. In SharePoint 2013, the permission level to default “Members” group was enhanced to Provide users with add, edit and delete Capabilities for the list.

The default Members group In SharePoint 2013 now has a new Permission level called “Edit”.
Navigate to Site Settings -> “Site Permissions” and look for the “Team Site Members” group. See the permission level “Edit”.
SharePoint 2013 Team Site Members
Please Note - Members group Can also have Contribute permission level by default. It depends on the Site Template that you have used to Create a Site.

With Edit Permission level, In addition to the Typical Contribute Permission users are now able to “add, edit and delete lists in your SharePoint 2013 Site.

Edit Permission level – “Can add, edit and delete lists; can view, add, update and delete list items and documents.”. The Screen below shows difference between Contribute & Edit Permissions.
SharePoint 2013 Edit and Contribute

So, now that you know your Members by default have Capabilities to edit and delete a list, you should Change the default Permission level of Members group to Contribute before adding users into it. See Step-by-Step Tutorial on How to Change default Permission Level for a group in SharePoint 2013 (from ‘Edit’ to ‘Contribute’)


Edit Layout Pages to add Snippets from Snippet Gallery in SharePoint 2013

In Continuation with our Series on Creating and Editing Master Pages and Layout pages in SharePoint 2013, In this post we will look at how to use “Snippet gallery” and how to add Snippets for SharePoint Controls in Layout Pages using the design manager.

How to Edit Page Layout
In SharePoint 2013 for every Layout page two files – .aspx and html are Created by default.For making Changes to the Custom Layout, you need to download the html file of the layout page and make Changes to it. The modified html file is then saved back to the MasterPage Page gallery and the corresponding .aspx file gets updated automatically.

In our case below are two files created.
"SharePoint 2013 Custom Layout files"
 
To work with these files you can either navigate to the Master Page gallery of your site or you can download them by Mapping the MasterPage Gallery as a Netwrok drive .See the Step-by-Step tutorial on How to Map MasterPage Gallery as a Netwrok drive.
 
Once your download a copy of “Custom Page Layout.html” file( using ‘Download a Copy’ option in callup menu \ecb menu) you can simply add\remove the desired code snippets from the file and save it.
 
Lets look at an example of adding a SharePoint field Control copied from the new Snippet Gallery feature into our Custom Layout page.
 
By Definition -Snippet Gallery is a feature that lets you add SharePoint Components to your HTML or Master Page Design file. Users can select a component like Navigation or Search box from the Gallery and configure its properties. They can then copy the HTML snippet that’s generated and add it to the HTML design file\Master page. After you add SharePoint components to your HTML files, you can use CSS to fully brand them

To Open the Layout page in the Snippet Gallery click on the Custom page layout in Design Manager in “Edit Page Layout’s” list.See the screen below

"SharePoint 2013 Create Layout Page"

When you click on the layout you will be taken to the Preview page of your layout. Click on “Snippets” top right corner.See below

"SharePoint 2013 Snnipet Gallery"

Next in the “Page Field” select “Article Date” field.



Once you select the Field, a preview of the Field and the corresponding HTML Code gets displayed. Copy the HMTL code for this field to clipboard and add it to our Layout Page’s HTML. Open the Layout Page in an editor of your choice and paste the Copied Code in it.

 See below
"SharePoint 2013 Add Snippet"

Save the Page and upload it back to MasterPage Gallery.

Once the Layout is Updated you must Publish it again as a Major Version before using it.
"Page Layout Publish as Version"

Next Create a Page using the new Custom Layout (See Steps Here) or edit the existing Layout for a page.

Finally, Edit the page and View the Changes.Notice the “Article Date” field added to the layout of the page in the screen below.
"SharePoint 2013 Page layout"


Control Rendering of List Items with JS Link SharePoint 2013

In Continuation with a series on JS Link, In this example we will look at How to Color Code List Items using a JavaScript File (using JS Link) in SharePoint 2013.

With JS Link reference to a JavaScript File in a WebPart, we can Control the Rendering of Fields & Items in a View, List Forms (Display,New,Edit) and event a WebPart.It is preferred that the
JavaScript file should be Uploaded as a new JavaScript Display Template in Site’s Master Page Gallery.JavaScript Display Template Content Type has some special Site Columns added to it that will help specify the target element (view,form,webpart etc..) where the JavaScript File’s Custom Rendering will be Implemented.

Lets Look at the Detailed Steps to Create a JavaScript File and use it in JS Link Property to Color Code List Items as per the Sales column Criteria. Here is the Before and After looks like -

Initial List -
Create Custom List before

Resulting items

http://www.learningsharepoint.com/wp-content/uploads/2013/04/ColorCoding List Items after.png

Lets Look at the Steps -
1. Create a JS File and Copy & Paste the below Script in your Js File. Save it as ColorCode_Items_Script.Js
(function () {
var itemCtx = {};
itemCtx.Templates = {};
itemCtx.Templates.Header = “<div><b>Sales Data</b></div><ul>”;
itemCtx.Templates.Item = ItemOverrideFun;
itemCtx.Templates.Footer = “</ul>”;
itemCtx.BaseViewID = 1;
itemCtx.ListTemplateType = 100;
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(itemCtx);
})();
function ItemOverrideFun(ctx) {
if (ctx.CurrentItem.Sales == ‘< 20K’)
{
return “<li style=’background-color: #52D017;width: 300px;height: 24px;’>” + ctx.CurrentItem.Title + ” – ” + ctx.CurrentItem.Sales + “</li></span>”;
}
if (ctx.CurrentItem.Sales == ‘> 20K’)
{
return “<li style=’background-color: #4AA02C;width: 300px;height: 24px;’>” + ctx.CurrentItem.Title + ” – ” + ctx.CurrentItem.Sales + “</li></span>”;
}
if (ctx.CurrentItem.Sales == ‘< 10K’)
{
return “<li style=’background-color: #FF0000;width: 300px;height: 24px;’>” + ctx.CurrentItem.Title + ” – ” + ctx.CurrentItem.Sales + “</li></span>”;
}
if (ctx.CurrentItem.Sales == ‘> 10K’)
{
return “<li style=’background-color: #D16587;width: 300px;height: 24px;’>” + ctx.CurrentItem.Title + ” – ” + ctx.CurrentItem.Sales + “</li></span>”;
}
}
Download Script

2. Upload your js file in Master Page Gallery as a new JavaScript Display Template.For this example, we have Created and Uploaded a JavaScript File “ColorCode_Items_Script.Js” in our Master Page Gallery as a new JavaScript Display Template.See the detailed Steps at Uploading JavaScript (JS Files) as JavaScript Display Template in SharePoint 2013
3. Create a Custom List with Items like below.

Create Custom List

4. Edit the WebPart and add JS Link reference path for the JavaScript File that you Upload in master Page Gallery.

 In our case the path is ‘~site/_catalogs/masterpage/ColorCode_Items_Script.js’
JS Link Reference

5. Once you hit apply the List Items should look like below.

Resulting Items


Popular Posts