2

I am looking for a way to increase the column width in a document library. Found a lot of ways to get this done by changing XSLT Changing Column Width

But I am looking for a way to change by page level using a script editor web part. Is this possible?

1 Answer 1

1

Try the below code in a content/script editor webpart. Change the name of the column. I see the max-width of the column is set to 500px. So if you want to make your column width more than 500px, then you have to change the max-width, otherwise that is not needed. I ran this code on SharePoint online and it worked fine.

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>
<script type='text/javascript'> 
$(document).ready(function(){
    var columnName = 'MyColumn';
    var element = $("div[name='" + columnName + "']").parent();
    var width = '600px';
    element.css('max-width', width);
    element.css('width', width) 
}); 
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.