简体   繁体   中英

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.

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".

How can I force that everytime a user opens the page with Project Center webpart, she will always open the "Summary" view?

Thanks.

This is a JavaScript solution I wrote that uses a query string parameter "viewuid" (GUID for the view) to set the view

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. 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.

Here is my example 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"); } 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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