3

Using VF I have a nice inline chart - are there anyways to make the VF page 'unclickable' so that if a user clicks on it, it won't load the report behind the chart? So clicks on the chart do nothing? Thanks!

2

Try add CSS below

a.analyticsCordaChart {
     pointer-events: none;
     cursor: default;
   }

it does the trick for me

1

You can use jQuery to unbind elements.

Example:

var j$ = jQuery.noConflict();
j$('a#...').attr('onclick','').unbind('click');

I tried this out using a simple example, but beware because unbinding elements may break other behavior (as you will find if you try to Refresh in the following example). Use at your own risk:

<apex:page>
    <analytics:reportChart reportId="00Oi0000005fuSS"></analytics:reportChart>
</apex:page>

Using Chrome, right-clicking the chart and selecting Inspect Element, I noticed that the chart is wrapped in <a class="analyticsCordaChart" .... So I tried the following

<apex:page>
    <analytics:reportChart reportId="00Oi0000005fuSS"></analytics:reportChart>
    <apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"/>
    <script>
        var j$ = jQuery.noConflict();
        $('a.analyticsCordaChart').attr('onclick','').unbind('click');
    </script>
</apex:page>
  • Hmm thanks, but this didn't stop the click through in Chrome. Chrome click on actually loads the full page in my little VF page. Poor! – jaw999 Aug 7 '14 at 15:43
  • You gotta find the element you want to unbind yourself and then test it to make sure you still have all the behavior you want – Scott Pelak Aug 7 '14 at 15:59
  • My example shows how to unbind an element with jQuery + some insight on how to search for HTML elements. Much luck :) – Scott Pelak Aug 7 '14 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.