如何更改 SharePoint 列表视图中列的宽度?

发布于 2024-10-02 17:31:56 字数 124 浏览 0 评论 0原文

我有 SharePoint 2007,并且有一个列表视图,其中有一个文本字段,当与相当多的其他字段一起显示时,该文本字段的宽度仅为大约 1 个字。

有没有办法在不使用 css 或其他 Web 编程语言的情况下扩展该列?

I have SharePoint 2007 and I have a list view that has a text field that, when shown with quite 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

面如桃花 2024-10-09 17:31:56

如果您无法使用 CSS、JavaScript、SharePoint Designer 或将任何 C# 代码部署到服务器......那么您就无法更改列的宽度。

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.

九公里浅绿 2024-10-09 17:31:56

尝试添加带有 CSS/JavaScript 的 ContentEditor Web 部件来设置列的外观。您不需要 C# 或 Designer。

我对搜索页面做了类似的事情,我需要触发 JavaScript 函数,因此我使用以下代码向页面添加了 CEWP(见下文)。

您可以更改此设置以查找要修改的列的 ID。请记住,SharePoint 中的控件 ID 是在页面呈现期间生成的,因此您不一定知道确切的 ID。这就是为什么此代码查找 ID 以“_PSB_Show”结尾的锚点,而不是查找确切的 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>

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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文