8/12/12

SharePoint XsltListViewWebPart Remove CheckBoxes for Custom Views


When displaying a list view with items, the XsltListViewWebPart adds by default a check box on the header (to select all the items) and to each row. The purpose of the checkbox is to select one or more items to enable some custom actions on the ribbon. An example of a list view with checkboxes is displayed below:



This out of the box feature is a great to have, but there are some cases in which we want to create custom views which may have many list views for different lists, and we do not want the custom action ribbon to be available. When the ribbon is not available and the user clicks on any checkbox, a JavaScript error is displayed as follows:



To avoid this problem, we need to remove the checkbox for the custom view only and not affect the other list views. If you edit your custom view on SharePoint Designer, you will not find any setting that allows you to do this. There is however an attribute that can be added to the markup which allow us to remove the checkbox. Edit your custom view/page and find the View tag for your list view. Add the attribute TabularView=FALSE to the view as you see below:



  Save the file and reload it on your browser.  When this attribute is set to false, the check boxes do not get created on the view as you can see below:




Since this change is only done to the custom view, it should not affect your other views/pages. I hope you find this helpful.

0 comments :

Post a Comment

What do you think?