Need to modify the width of a SharePoint column in a view? jQuery!

I recently had a request on one of my sites to increase the size of the Description column in the SharePoint views. Out of the box, there’s no easy way to do that. But, with a little snippet of jQuery placed in a Content Editor Web Part on the page with the view, you can easily change any of the column widths…

Here’s the code I used:

<!--ADJUST TABLE COLUMN WIDTH-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript">
</script>
<script type="text/javascript">
$(function(){
$("div.ms-vh-div:contains('Description')").css("width", "350px");});</script>

If you have multiple columns to modify, just repeat the line with the “div.” string. This is so simple, my customer went in and made her own changes to the code.

Many thanks to Mark Miller, who provided the solution in the postΒ SharePoint jQuery: Setting View Column Width.

 

6 responses to “Need to modify the width of a SharePoint column in a view? jQuery!

  1. Thank you! Thank you! Thank you!

  2. Mohammed Ruman's avatar Mohammed Ruman

    Works!
    Thank you πŸ™‚

  3. Hi, I tried applying this but it doesn’t seem to be working in edit mode or datasheet view mode? Has someone encountered the same problem?

  4. Yes.. It is not working in quick edit mode

  5. how can make this script available across all the Views

  6. In order to get this to work, you have to add a script editor web part to your page and embed the script snippet.

Leave a reply to Rhea Cancel reply