0
votes

I want that whenever a user visits a certain page with Project Center webpart in it, she should have her View already set (forced) e.g. "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.

2

2 Answers

0
votes

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});
      }
   }
}
0
votes

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 I.E. 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");
}