+ Start a Discussion
Tom Blamire 24Tom Blamire 24 

Visualforce Weirdness

Hi,

I have created a VF page that shows 4 report graphs using the <analytics:reportChart> method. This is where it gets weird. If i was to add it to a page layout then it works fine. Graphs show correctly, refresh button works, and if i click the graph it opens the report in a new window  - perfect!
However, if i add it to the home page as a vf component then it all works apart from when you try to click to show the report then it shows in the home page section. 
Is there something i am missing or unaware of? by the way, i am a complete novice/noob to VF and Apex in case you hadnt noticed!

my VF page is as follows:
<apex:page sidebar="true" >

 <apex:form >
  <apex:pageBlock title="Challenge Resolution" >
   <apex:pageBlockSection columns="4" >
  
    
     <analytics:reportChart ReportId="00O8A000000Jh2Z" showRefreshButton="true" size="small" cacheResults="false" />
     <analytics:reportChart ReportId="00O8A000000Je3o" showRefreshButton="true" size="small" cacheResults="false" />
     <analytics:reportChart ReportId="00O8A000000JeWv" showRefreshButton="true" size="small" cacheResults="false" />
     <analytics:reportChart ReportId="00Oi0000006EXC0" showRefreshButton="true" size="small" cacheResults="false" />
    

   </apex:pageBlockSection>   
  </apex:pageBlock>
 </apex:form>     
</apex:page>

 
Tom Blamire 24Tom Blamire 24
Hi SF Issue-Fixer

Unfortunately it is still opening in the Home Page section rather than a new window  :(
Tom Blamire 24Tom Blamire 24
Hi SF Issue-Fixer,

Some here's something i noticed, when i used that last piece of code it was still opening in the same component which was annoying. I then went to my user profile and turned on the 'Development Mode' check box and tried it again. It will now work as expectedbut the only issue is that i want to assign this feature to the users who will be viewing it. Any suggestions?
Tom Blamire 24Tom Blamire 24
Frustratingly it still only opens in the home page component
Sunil MadanaSunil Madana
Hi Tom, can you try to replace the javascript section to the below please:
<script type="text/javascript">
        function OpenWin(Id){
            var url = 'https://ap1.salesforce.com/'+Id;
            window.open(url, "_blank");
        }
</script>
Thanks.
Tom Blamire 24Tom Blamire 24
still not opening in new window
 
Sunil MadanaSunil Madana
Hi, sorry for the confusion. Below is my final code and hope it helps.
<apex:page sidebar="true" >
	<script type="text/javascript">
		function OpenWin(Id){
			var url = 'https://ap1.salesforce.com/'+Id;
			window.open(url, "_blank");
		}
    </script>
	<apex:form >
		<apex:pageBlock title="Challenge Resolution" mode="detail">
			<apex:panelGrid columns="3" id="theGrid">
				<apex:outputLink onclick="OpenWin('00O8A000000Jh2Z');">
					<analytics:reportChart ReportId="00O8A000000Jh2Z" showRefreshButton="true" size="small" cacheResults="false" />
				</apex:outputLink>
				<apex:outputLink onclick="OpenWin('00O8A000000Je3o');">
					<analytics:reportChart ReportId="00O8A000000Je3o" showRefreshButton="true" size="small" cacheResults="false" />
				</apex:outputLink>
				<apex:outputLink onclick="OpenWin('00O8A000000JeWv');">
					<analytics:reportChart ReportId="00O8A000000JeWv" showRefreshButton="true" size="small" cacheResults="false" />
				</apex:outputLink>
				<apex:outputLink onclick="OpenWin('00Oi0000006EXC0');">
					<analytics:reportChart ReportId="00Oi0000006EXC0" showRefreshButton="true" size="small" cacheResults="false" />
				</apex:outputLink>
			</apex:panelGrid>
		</apex:pageBlock>
	</apex:form>
</apex:page>
Thanks.