开发者

How can I change the width of a column in a list view is SharePoint?

开发者 https://www.devze.com 2023-01-25 08:43 出处:网络
I have SharePoint 2007 and I have a list view that has a text field that, when shown with quite 开发者_JAVA百科a few other fields, is only about 1 word narrow.

I have SharePoint 2007 and I have a list view that has a text field that, when shown with quite 开发者_JAVA百科a few other fields, is only about 1 word narrow.

Is there a way to expand that column without access to css or other web programming languages?


If you can't use CSS, JavaScript, SharePoint Designer, or deploy any C# code to the server.. then you can't change the width of the column.


Try adding a ContentEditor Web Part with the CSS/JavaScript that sets the look of the column. You don't need C# or Designer.

I did something similar with a search page where I needed a JavaScript function to be triggered so I added a CEWP to the page with the following code (see below).

You could change this to look for the id of the column you want to modify. Just remember that ID's of controls in SharePoint are generated during the page render so you won't necessarily know the exact ID. That is why this code looks for an anchor with an ID that ends with '_PSB_Show', instead of looking for the exact ID.

<script type="text/javascript">
var anchors = document.getElementsByTagName("a");
var anchor;
var j; 

// Iterate through all anchors on the page and find the one with ID ending in _PSB_Show
for (j = 0; j < anchors.length; j++)
{
   if (anchors[j].id.match(/\_PSB_Show$/) != null)
   {
      anchor = anchors[j];
      break;
   }
} 

// If the anchor is found and the click is supported in the current browser
// Perform a click after 100 ms
if ((anchor != null) && (anchor.click != null))
{
   setTimeout("anchor.click();", 100);
}
</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消