Create SharePoint list view

In this SharePoint tutorial, we will discuss on SharePoint list view, how to create a list view in SharePoint Online modern site as well as in classic site.

Also, we will see how to display SUM Total in SharePoint list views.

SharePoint Online modern experience introduced a new way to create Views more quickly. In SharePoint 2010/2013 classic experience, we can create Views in a traditional way that takes time but in SharePoint Online, Microsoft introduced a new way of creating Views. Let us explore how to create a View using this new feature in Modern sites and Classic SharePoint sites.

Create List View in Modern SharePoint Sites

Here I have a created a custom SharePoint list as “Employee information” which has few columns and the list looks like below:

create list view in sharepoint online
sharepoint list view

In modern SharePoint site, users can’t quickly create a View on the location and skill-based filter in a traditional way.

We overcome the limitation of the SharePoint List View using the new feature of SharePoint Online.

Create a View on location and skill-based filter in SharePoint list

Open the list in “All items” view and apply the filter on location and skills column. Then, click expand All Items and select the save view as option like below:

create list view in sharepoint online modern list
create sharepoint view

Then it will show a popup, where you can give a view name and click on the Save button like below:

how to create list view in sharepoint online modern list
list view sharepoint

Finally, the SharePoint Online list view will looks like below:

how to create list view in sharepoint online
sharepoint online list views

Create a List view in Classic SharePoint Site

Now, we will see how we to create the same fiter view using SharePoint Online classic experience.

Here, I have created a custom list, “Employee information” which looks like below:

create list view in sharepoint 2013
sharepoint list view

In classic SharePoint site, the users can’t quickly create a view on the location and skills-based filter in a traditional way.

We overcome the limitation of the SharePoint list view using SharePoint 2013 new feature.

Create a view on location and skills base filter

Open the list all items view and apply the filter on location and skills column and click on SAVE THIS VIEW hyperlink.

create list view in sharepoint 2013 list
sharepoint views

After selecting SAVE THIS VIEW Hyper link the below pop screen appears. Set the view name and click on the Save button.

how to create list view in sharepoint 2013 list
sharepoint list views

Finally the classic SharePoint list view will look like below:

how to create list view in sharepoint 2013
create sharepoint view

SharePoint list view styles in classic site

Here we will see how to create list view styles in the classic sites. There are 8 ways to create list view styles

  • Default
  • Basic Table
  • Boxed, No labels
  • Boxed
  • Newsletter
  • Newsletter, no lines
  • Shaded
  • Preview Pane

To edit the list view in classic SharePoint site, Open list in classic site-> Click on All items view -> Select Edit current view -> Go to bottom of the Edit view page->Select Style hyperlink-> choose view styles( as per your requirement)-> Click OK.

SharePoint view styles in classic site
SharePoint view styles in classic site

We will see the above list view styles by creating a list(e.g. Project management list) in SharePoint classic site. And also it is a Default view i.e. All Items view.

Default view style SharePoint classic site
Default view style SharePoint classic site

Basic Table

This view is similar to default view but add new item link is shown just below the view.

Basic table view in SharePoint classic site
Basic table view in SharePoint classic site

Boxed, No labels

This SharePoint view provides card view, and also labels are not there with the value.

SharePoint list view style
Basic table view in SharePoint classic site

Boxed

This SharePoint view is similar to the above view, here labels are there with the value.

SharePoint list view styles
SharePoint list view styles

Newsletter

This SharePoint style view, display the information one below other.

SharePoint online list view styles
SharePoint online list view styles

Newsletter, no lines

This SharePoint view is similar to the above view, the only changes instead of line row is separated by shaded bar.

SharePoint online list view styles
SharePoint online list view styles

Shaded

This SharePoint view style is similar to the basic table view, the only difference is Shaded color in alternate row.

SharePoint online list view styles
SharePoint online list view styles

Preview Pane

This SharePoint view style having two parts: one each title column is listed and the other display values of the other columns when you hover over the Specific title column. This view takes less space to present.

SharePoint online list view styles
SharePoint online list view styles

The above are the examples of SharePoint list view styles.

SharePoint list group by month and year example

Let us see, how to group a SharePoint document library by year created in SharePoint 2013/2016/2019/Online

SharePoint List view Group By Year

Open the SharePoint document library and then go to the LIBRARY tab and then click on Settings Icon and then Library Settings. Then go to the Columns and click on Create Column.

Then give the Column name and chose the calculated column and then in the Formula box type =Year(Created). Then The data type returned from this formula is Number as shown in the fig below:

sharepoint library group by month and year
sharepoint library group by month and year

Now go to the Views section and then click on Create View and then Choose Standard View from the view type. This will open the Create View page. Give a name for the view.

Then go to the Group By and then the First group by the column: select the column name which we have created. It will appear like below:

sharepoint list group by month and year
sharepoint list group by month and year

Then click on OK and now check the view it will appear like below:

sharepoint library group by month and year
sharepoint library group by month and year

SharePoint List View Group By Month

Similarly, if you want to do a group by based on month-wise then while creating the column (calculated column), in the formula write like below:

=YEAR(Created)&”/”&RIGHT(“0″&MONTH(Created),2)

sharepoint list group by month
sharepoint list group by month

And the list view will appear like below:

sharepoint library group by month
sharepoint library group by month

SharePoint List view Group By Year and Month

In this case, create 2 columns one for a month and one for a year like above. Also, use the same formula which we have written above. Now got to the view and then go to the Group By and there give on Year in the first and Month in second like below.

sharepoint list group by month and year
sharepoint list group by month and year

Now it will appear like below:

sharepoint list group by month
sharepoint list group by month

Let us see, how to group SharePoint document library by Year and Month Created in SharePoint 2013/2016/2019/Online.

Display Sum Total in SharePoint 2013 Online List View

This SharePoint customization tutorial we will discuss how to show sum total in SharePoint 2013/2016/Online list view by using out of box feature.

In this example, I have a SharePoint 2013/2016/Online custom list which has two Number fields as Age and Salary. The list looks like below:

show sum total in SharePoint 2013 online list view
Display Sum Total in SharePoint 2013 Online List

Here I want to see a Sum of Age and Sum of Salary Column in the SharePoint list view.

Display Sum Total in SharePoint List View

For this Open the SharePoint list view in the browser, then go to List tab in the Ribbon and then click on Modify View like below:

show sum total in SharePoint online list view
Display Sum Total in SharePoint 2013 Online List

This will open the Modify List view page. In this page navigate to the Totals page and expand that.

Then for the particular column choose Sum from the drop-down under Total. The option will come according to the column data type.

Let’s say Sum will appear for Numeric data type columns. But for single line data types column, Sum option will not appear.

It should look like below:

show sum total in SharePoint 2013 list view
Display Sum Total in SharePoint 2013 Online List

Now click on OK and then you will be able to see the Sum in the list view like below:

show sum total in SharePoint list view
Display Sum Total in SharePoint 2013 Online List

Remove Sum text from SharePoint 2013 Online List View using JavaScript

Now, we will see how to remove “Sum=” text from SharePoint 2013 list view. Here I have a SharePoint 2013 list where I have a Salary column. I am displaying the total Sum for the Salary column by following this article.

Here below to the Salary column, the sum is displaying as Sum=37,000.00. It displays like below:

Remove Sum text from SharePoint 2013
Remove Sum text from SharePoint 2013 Online List

But my requirement is to remove the “Sum=” text, I just want to display the total sum.

Remove Sum text from SharePoint 2013 Online List View using JavaScript
Remove Sum text from SharePoint 2013 Online List

Remove Sum text from SharePoint 2013 Online List View using JavaScript

This we can do by writing a simple JavaScript code. Open the SharePoint list view page then edit the page. In edit mode add a web part and choose script editor web part in SharePoint. Then put the below code inside the script editor web part.

<script type="text/javascript">

function hideSum(myString) {
var docTags;
docTags = document.getElementsByTagName("B");
for (var i=0; i < docTags.length; i++) {
docTags[i].innerText = docTags[i].innerText.replace(myString,"");
}
}

_spBodyOnLoadFunctionNames.push(‘hideSum("Sum=")’);
</script>

Now you will not able to see the Sum= text. It only shows the total sum.

Here we saw, how to remove Sum text from SharePoint 2013 Online List View using JavaScript.

Show paging at top in SharePoint list view web part

Let us see, how to show paging at the top in the list view web part in SharePoint 2013 online or SharePoint on-premise.

By default in SharePoint 2013 Online or SharePoint on-premise paging for list or document library shows at the button of the page. It looks like below:

Show paging at top in list view web part SharePoint
Show paging at top in list view web part in SharePoint

If you have any user who is coming from MOSS 2007 to SharePoint 2013 or Online, then they might see the different user experience. This way we got the requirement to change the paging button positions from the button to the top of the list view web part. We can do this by using JavaScript or jQuery object model.

Show paging at top in list view web part in SharePoint

You can edit the page which contains your list or document library. Then add a script editor web part into the page and add the below code into the page.

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<script type="text/javascript">
$(document).ready( function()
{
var header = $("table.ms-listviewtable");
var table = $("#bottomPagingCellWPQ2");

if(header && table)
{
table.insertBefore(header);
$("#bottomPagingCellWPQ2″).css('text-align', 'right');
}
else
{
alert('jQuery did not found Elements.');
}
});
</script>
<style type="text/css">
td#bottomPagingCellWPQ2{float:left}
</style>

After this Save the page and now you can see the paging button will appear in the top of the list view web part.

Show paging at top in list view web part SharePoint using jquery
Show paging at top in list view web part in SharePoint

This is how to show paging at the top in list view web part in SharePoint 2013/2016/Online using jQuery.

Show Ribbon for ListViewWebPart on SharePoint Page

By default, if you have multiple list view web part in page sometimes you will be able to see the Files and Libraries tab in the ribbon for document libraries. Or if you have listed in the page you may not see the ITEMS & List tab.

After you select the list view web part then the tabs for the corresponding list or libraries appears. Recently in one of my site few business users come saying we were not able to see the Files and Libraries tab then how could we upload the document.

First, we have a solution saying select a row then ribbon will appear but something they do not want to do like that.

So whenever they open a page list view ribbons options do not come like below:

Show Ribbon for ListViewWebPart on SharePoint Page
Show Ribbon for ListViewWebPart on SharePoint Page

Then we got one solution from MSDN which works perfectly for us.

Show Ribbon for ListViewWebPart on Page SharePoint

Just put the below code in a script editor web part in the page in SharePoint.

<script language="javascript" type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(ShowContextRibbonSections, "sp.ribbon.js");

function ShowContextRibbonSections(){
var initInfo = {
editable: true,isEditMode: false,allowWebPartAdder: false
};
SP.Ribbon.WebPartComponent.registerWithPageManager(initInfo);
var wpcomp = SP.Ribbon.WebPartComponent.get_instance();
if(wpcomp){
var zc = document.getElementById("MSOZoneCell_WebPartWPQ3");
wpcomp.selectWebPart(zc, true);
}
}

</script>

MSOZoneCell_WebPartWPQ3: Here for the particular web part zone you can get the id by using firebug or by inspecting element in chrome browser.

Once we put the code and save the page, it appears like below:

Show Ribbon for ListViewWebPart on Page SharePoint Online
Show Ribbon for ListViewWebPart on SharePoint Page

You may like following SharePoint tutorial:

This is a good feature in SharePoint Online to create list views on the fly. Here we saw how to create SharePoint list view.

>