Monday, March 27, 2017

Add an X before refiners in SharePoint search

In SharePoint Search, it's not really clear how to unselect a refiner after you select one. There's a real easy fix to add an X in front of it:

 .ms-ref-filterSel > div::before { 
          content: 'x '; 
}



Wednesday, March 8, 2017

Export XsltListViewWebParts

Anatoly Mironov has a great post on how to export web parts when the export functionality is disabled (like XsltListViewWebParts).  Find the full post here.

In summary:

Use the following url, changing the guid string with the web part id:

https://intranet.contoso.com/_vti_bin/exportwp.aspx?pageurl=https://intranet.contoso.com/Pages/default.aspx&guidstring=0c3adfe9-8f5d-4432-918a-42410e4e324d

where the web part id can be retrieved by looking at the source code, finding your web part, and looking for the:

<div webpartid="0c3adfe9-8f5d-4432-918a-42410e4e324d" ........ >

Monday, March 6, 2017

Create modal dialog popup for link in ItemStyle.xsl

To create a modal dialog popup in a Content Query Web Part, edit the ItemStyle.xsl file and replace the anchor tag with the following in the template selected:

<a onclick="javascript:SP.UI.ModalDialog.ShowPopupDialog('{$SafeLinkUrl}'); return false;" title="{@LinkToolTip}">


Wednesday, March 1, 2017

Switching Page Layouts and your web parts went missing?

If you switch the page layout of a page, and the new page layout has different web part zones, you might lose the web parts you meticulously setup.  But they're not gone.  You can go to the page and go to the web part view by adding ?Contents=1 to the the url and you'll see the web parts:


If you just select them and press close, they'll show up in your Closed Web Parts section:


And then you can just add them back to the new web part zones!

New Page Default Settings for Add a Page not working

If you have a site where you set the New Page Default Settings to a certain page layout:


yet when you select "Add a Page", the site keeps creating a Wiki page, just go to the site features and deactivate the "Site Pages" feature: