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!
-
See: stackoverflow.com/questions/2091168/disable-a-link-using-css – Adrian Larson♦ Mar 3 '16 at 2:06
-
what about making an onclick event open the filtered report in a new tab/window? – jaw999 Mar 7 '16 at 18:22
-
In that case you would want to follow Scott's advice, except bind a click handler. – Adrian Larson♦ Mar 7 '16 at 18:28
Try add CSS below
a.analyticsCordaChart {
pointer-events: none;
cursor: default;
}
it does the trick for me
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