Skip to main content

Posts

Showing posts from 2015

SharePoint Script Editor Webpart - Height

If you have worked with Script Editor webpart in IE you would have noticed that you do not get the flexibility to increase the height of it. You can use other browsers and get around this limitation. To work around this in IE isn't very difficult, use the following style and you can set the height of the webpart easily: <style> .ms-rte-embeddialog-textarea{ height:600px; </style> By manipulating the class ms-rte-embeddialog-textarea we can vary the height of the Script Editor webpart. The above style has to be within the webpart.  

DataView Webpart - Sorting on Column headers (without coding)

I looked around alot for solution to sorting columns in DataView webparts and couldn't find an easy solution. Apparently there was an easy solution, right under our nose! Open the site in SharePoint Designer and navigate to the page where you have the webpart. Select the webpart and in the ribbon navigate to DataView Tools - Design . Check the options Header and Sort & Filter on Headers and you are all set! PS: I have got it working on SPD 2013 but you may want to check if the same applies to SPD 2010.

Change SharePoint/O365 MasterPage using JSOM

Here is one way to change the master page of a SharePoint site using JSOM, I have tested this in O365 site but it should work with on-prem version of SharePoint as well. This code can be run on a script editor webpart and it works on the click of a html button control. <script src="/_layouts/15/SP.Runtime.js" type="text/javascript"></script> <script src="/_layouts/15/SP.js" type="text/javascript"></script> <script type="text/javascript"> function ChangeMasterPage() { var customMasterPage = "/_catalogs/masterpage/Custom.master"; var siteRelativeUrl = _spPageContextInfo.siteServerRelativeUrl; var clientContext; var currentWeb; SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function () { clientContext = new SP.ClientContext.get_current(); currentWeb = clientContext.get_web(); currentWeb.set_customMasterUrl(siteRelativeUrl + customMasterPage); currentWeb.set_maste