动态SharePoint Web部件的宽度和高度

6 sharepoint height web-parts width

我试图动态调整SharePoint Web部件页中Web部件的宽度和高度,以便它填满整个可用空间.似乎无法从SharePoint中的Web部件属性编辑器窗口中选择宽度和高度的百分比.此外,尝试通过代码在Web部件实例上动态设置它会导致SharePoint抛出不支持比例维度的异常.

有没有办法使用,例如,Javascript?我已经看到使用jQuery完成了类似的事情,但不完全是我正在寻找的东西(我对jQuery不够熟悉,无法自己提出一些东西).

Ale*_*gas 3

这里有一个可用的 Web 部件可以执行此操作您还可以在TechNet 社区上看到来自“potta vijay kumar”的解决方案(我也在那里找到了该 Web 部件):

function calcHeight() 
{ 
  //find the height of the internal page 
    var the_height= 
    document.getElementById('contentpage').contentWindow. 
      document.body.scrollHeight; 

  //change the height of the iframe 
  document.getElementById('contentpage').height= 
      the_height; 
}
Run Code Online (Sandbox Code Playgroud)

contentpage是 iframe 的 ID。

EndUserSharePoint 提供了jQuery 解决方案