简体   繁体   English

如何在Project Server 2013上强制执行Project Center视图?

[英]How to force a Project Center View on Project Server 2013?

I want that whenever a user visits a certain page with Project Center webpart in it, she should have her View already set (forced) eg "Summary", "Earned Value" etc. 我希望每当用户访问带有Project Center Webpart的特定页面时,都应该已经设置(强制执行)其“视图”,例如“摘要”,“收益值”等。

I know that the view is bound to the user's last session, so if during her last visit the user changed the View into "Earned Value", the next one will be "Earned value". 我知道该视图绑定到用户的上一次会话,因此如果用户在上次访问期间将视图更改为“ Earned Value”,则下一个将是“ Earned value”。

How can I force that everytime a user opens the page with Project Center webpart, she will always open the "Summary" view? 我如何强制用户每次使用Project Center Webpart打开页面时,她总是打开“摘要”视图?

Thanks. 谢谢。

This is a JavaScript solution I wrote that uses a query string parameter "viewuid" (GUID for the view) to set the view 这是我写的一个JavaScript解决方案,它使用查询字符串参数“ viewuid”(用于视图的GUID)来设置视图

var projCenterExt;
var JsGridSatellite;

_spBodyOnLoadFunctionNames.push("projCenterChangeView")

function projCenterChangeView() 
{
   if (window.location.search.toLowerCase().indexOf("viewuid") >= 0)
   {
      var JsGridViewUid = window.location.search.toLowerCase().split("viewuid=")[1].split("&")[0];

      if (typeof projectCenterComponent !== 'undefined')
      {
         if (typeof JsGridSatellite === 'undefined') JsGridSatellite = projectCenterComponent.get_GridSatellite();

         JsGridSatellite.LoadNewView({uid: JsGridViewUid});
      }
   }
}

Thanks Papa Daniel. 谢谢爸爸丹尼尔。 You got us started but this would only work in Chrome. 您已使我们开始,但这仅在Chrome中有效。 We had to add a pause in there and then it worked in IE Just to be clear, you need to find the GUID of the view you want to display and use that in your hyperlink. 我们必须在其中添加一个暂停,然后才能在IE中使用它。为了清楚起见,您需要找到要显示的视图的GUID,并在超链接中使用它。

Here is my example http://projectserver/PWA/SitePages/ITDDash.aspx?idViewUID=38f25d41-2391-4ed4-b84e-2befec36b80b 这是我的示例http://projectserver/PWA/SitePages/ITDDash.aspx?idViewUID = 38f25d41-2391-4ed4-b84e-2befec36b80b

 var projCenterExt; var JsGridSatellite; _spBodyOnLoadFunctionNames.push("projCenterChangeView") //console.debug("before projCenterChangeView"); function projCenterChangeView() { //alert("in projCenterChangeView"); //console.debug("before 3 secs"); setTimeout(function(){ //alert("in if:"+window.location.search.toLowerCase().indexOf("viewuid") ); if (document.location.search.toLowerCase().indexOf("viewuid") >= 0) { var JsGridViewUid = document.location.search.toLowerCase().split("viewuid=")[1].split("&")[0]; //alert("in if:"+JsGridViewUid ); if (typeof projectCenterComponent !== 'undefined') { if (typeof JsGridSatellite === 'undefined'){ //console.debug("JsGridSatellite kis undefined"); JsGridSatellite = projectCenterComponent.get_GridSatellite(); //alert("jjc test"); } JsGridSatellite.LoadNewView({uid: JsGridViewUid}); //orig } //JsGridSatellite.LoadNewView({uid: JsGridViewUid}); } //console.debug("after 3 secs"); }, 1000); //alert("at end"); } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM