+ Start a Discussion
Sushma  RamakrishnanSushma Ramakrishnan 

Need help to disable click on analytics:reportChart

Hi All,

I have made use of analytics:reportChart to display report in my VF page.
my BR is that the user should just be able to view the report but not be able to click on it.
<apex:page standardController="Account" showHeader="False" sidebar="False">  
<script type="text/javascript">
function disableclickfun()
{
    document.getElementById(rc).disabled=true;
}
</script>  
  <apex:pageBlock >
      <apex:pageBlockSection id="TestSpend" title="Test Spend Data Report" columns="1" collapsible="true" showHeader="false">
          <apex:PageBlockSection columns="2" onclick="disableclickfun()" id="rc">          
                 <analytics:reportChart reportId="00Oi0000005damv" size="medium" showRefreshButton="false" cacheResults="false" 
                 filter="[{column:'Test_NAME', operator:'equals', value:'{!$CurrentPage.parameters.name}'}]"  ></analytics:reportChart>
                  
                <analytics:reportChart reportId="00Oi0000005damt" size="medium" showRefreshButton="false" cacheResults="false"
                filter="[{column:'Test_NAME', operator:'equals', value:'{!$CurrentPage.parameters.name}'}]}]"></analytics:reportChart>
           </apex:PageBlockSection>    
      </apex:pageBlockSection>
  </apex:pageBlock>
</apex:page>



Thanks for Any & All Help!
 
SandhyaSandhya (Salesforce Developers) 
Hi,

I see in your code that you are not using quotes for 
document.getElementById(rc).disabled=true;

Try putting quotes and see if that can help you.

document.getElementById('rc').disabled=true;

And also try to put alert disableclickfun() and see if that method is getting called when you click.

Hope this helps you!

If this helps you, please mark it as solved.

Thanks and Regards
Sandhya


 
Sushma  RamakrishnanSushma Ramakrishnan
Hi Sandhya,

Thanks for that correction & have added alert too to test.
Yes its hitting that line but still its not stopping a user from clicking on the report.

Thanks!
SandhyaSandhya (Salesforce Developers) 
Hi,

Please refer below links which have some solutions for the similar issue.

http://salesforce.stackexchange.com/questions/46269/visualforce-reportchart-can-we-disable-access-to-report-behind-it

Thanks and Regards
Sandhya