You need to sign in to do that
Don't have an account?

Opening visualforce chart in current window or new tab
Hi,
I am new to Apex and visualforce and having ago!
I have managed to create a small visualforce page to show charts on my projects page which filters fine using the following code (section of): -
<apex:page StandardController="pse__Proj__c">
<apex:pageblock >
<apex:pageblockSection columns="4">
<analytics:reportChart reportId="00OJ0000000hi2k"
filter="{column:'pse__Proj__c.Name', operator:'equals', value:'{!pse__Proj__c.Name}'}" size="small">
</analytics:reportChart>
When I click on this it opens the report within the small visualforce section and I would like this chart, when clicked to open in a new window, or even in a new tab.
Do I need a controller for this or is it simple code like open.window...parent etc ...
Thanks
Me
I am new to Apex and visualforce and having ago!
I have managed to create a small visualforce page to show charts on my projects page which filters fine using the following code (section of): -
<apex:page StandardController="pse__Proj__c">
<apex:pageblock >
<apex:pageblockSection columns="4">
<analytics:reportChart reportId="00OJ0000000hi2k"
filter="{column:'pse__Proj__c.Name', operator:'equals', value:'{!pse__Proj__c.Name}'}" size="small">
</analytics:reportChart>
When I click on this it opens the report within the small visualforce section and I would like this chart, when clicked to open in a new window, or even in a new tab.
Do I need a controller for this or is it simple code like open.window...parent etc ...
Thanks
Me
where are you opening this page from?
On another note, you shouldn't hard code the report id. try saving it in cusotm setting, as the report id will chaneg when you deploy to production
Its sitting on a custom objects page layout as a visualforce component. SO a user clicks it and it just opens the visualforce component into a report where as I would rather be able to open the report in a new window or new tab if that makes sense
I didn't think if that withthe report ID, I will have a look at creating on of those
<script type="text/javascript">
function Test(){
var url = '/00OJ0000000hi2k';
window.parent.location.replace(url);
}
</script>
<apex:outputLink onclick="Test();">
<analytics:reportChart reportId="00OJ0000000hi2k"
filter="{column:'pse__Proj__c.Name', operator:'equals', value:'{!pse__Proj__c.Name}'}" size="small">
</analytics:reportChart>
</apex:outputLink>
</apex:page>