【问题标题】:How to force a Project Center View on Project Server 2013?如何在 Project Server 2013 上强制使用项目中心视图?
【发布时间】:2016-05-09 18:22:42
【问题描述】:
我希望每当用户访问其中包含项目中心 webpart 的某个页面时,她应该已经设置了她的视图(强制),例如“摘要”、“挣值”等
我知道视图绑定到用户的最后一个会话,所以如果在她上次访问期间用户将视图更改为“挣值”,下一个将是“挣值”。
如何强制用户每次使用项目中心 webpart 打开页面时,她总是会打开“摘要”视图?
谢谢。
【问题讨论】:
标签:
sharepoint
sharepoint-2013
project-server
ms-project-server-2013
【解决方案1】:
这是我编写的一个 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});
}
}
}
【解决方案2】:
感谢丹尼尔爸爸。您让我们开始了,但这仅适用于 Chrome。我们必须在其中添加一个暂停,然后它在 I.E. 中工作。为了清楚起见,您需要找到要显示的视图的 GUID,并在超链接中使用它。
这是我的例子
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");
}