When you add OTB XsltListView web part on the page by default it shos toolbar over the list content:
Of course you may remove this toolbar manually by going to web part properties and setting Toolbar Type to “No toolbar”. But what to do if we need to set it automatically during provisioning without manual work?
If you worked with XslListViewWebPart in Sharepoint 2010 then you probably know that even with server object model it is possible to remove toolbar only using reflection, e.g. like shown here:
But how to do the same in Sharepoint Online where we don’t even have server object model (not even mention reflection)? People on the forums tried to do it via client side object model (CSOM), but without luck, because setting View.Toolbar property to <Toolbar Type='None'/> is ignored: see Hiding the toolbar of a Listview webpart through CSOM.
Fortunately in Sharepoint 2013 there is another powerful mechanism which can be used for hiding toolbar of XsltListViewWebPart: client side rendering. Of course it can be used for other purposes as well, but in this article we will use it for hiding toolbar.
First of all we need to define template override in separate js file and upload this file to the Sharepoint doclib:
After that we need to set JSLink property of web part pointing to this file. E.g if our file is uploaded to Site assets link will be the following;
In example above we defined override template with custom post render handler. In the handler we hide DOM element which contains toolbar. After that XsltListViewWebPart will look like this:
Hope that this information will help you.