I'm inserting some HTML with a multi-line fusion chart rendered by Ruby on Rails into a perl page. In Firefox, Safari, and Opera everything works fine, but IE7 (and presumably IE6) both fail when executing some of my javascript to update the chart. I'm loading my chart inside of a JQuery dialog object, which is a javascript modal dialog. Normally IE behaves fine and after the first dialog load I can change a dropdown which calls setDataURL and requests an XML update to the chart, which all works perfectly. If I close the dialog and reopen it, then the dropdown's setDataURL fails with a "Unknown name" error. If I don't call the dialog constructor and just let the div be visible, then the dropdown doesn't work at all, and I get an "Unknown name" error. One interesting thing about IE and the dialog is that when it is opened a second time the chart and the dropdown are the same as they were before closing the dialog. In the other browsers the chart reverts back to the initial setting but the dropdown remains what it was prior to being closed.
Here is what I've tried thus far:
1. Since I am using SSL/HTTPS, I told both the HTML partial from RoR and the XML chart data to set response.headers["Pragma"] = "public" and response.headers["Cache-Control"] = "cache, must-revalidate". Didn't seem to have any effect.
2. Instead of using getChartFromId I instead called the FusionChart constructor along with render and print. This doesn't throw a javascript error, but it doesn't display the requested chart either.
3. Escaping the URL used in setDataURL. Didn't seem to make a difference.
4. Tried not using HTTPS, switched everything over to use HTTP. Didn't notice a difference.
I have the register_with_js flag set also, just to get that out of the way. Not sure what else I can do at this point.
Here are relevant bits of my code:
rails controller methods:
def historical
response.headers["Pragma"] = "public"
response.headers["Cache-Control"] = "cache, must-revalidate"
render :layout => false
end
def historical_data
response.headers["Pragma"] = "public"
response.headers["Cache-Control"] = "cache, must-revalidate"
range = lookup_range(params[:range] || t('.performance_feedbacks.historical.days_7'))
@categories, @values = get_data_method
render :layout => false
end
rails view code (in haml):
historical.html.haml:
#historical_performance
.range
= t '.range'
- onchange = "getChartFromId('historical_chart').setDataURL('#{historical_data_performance_feedbacks_path}?range=' + this.options[this.selectedIndex].text + '&session_token=#{params[:session_token]}');"
= select_tag 'date_selector', '<option>' + @historical_range.join('</option><option>') + '</option>', :onchange => onchange
.note
= t '.insufficient_data_note'
#historical_performance_chart.chart
- render_chart('/nextgen/FusionCharts/MSLine.swf', historical_data_performance_feedbacks_path(:session_token => params[:session_token]), '', 'historical_chart', 600, 300, true, true) do end
historical_data.html.haml:
%graph{:yAxisMaxValue => '10',
:decimalPrecision => '0',
:lineColor => '00A7E2',
:lineThickness => '2',
:showShadow => '0',
:numdivlines => '9',
:rotateNames => '1',
:anchorRadius => '7',
:anchorBgColor => 'FFFFFF',
:anchorBorderColor => '00A7E2',
:anchorBorderThickness => '2',
:AlternateVGridColor => 'F4F6EF',
:showAlternateHGridColor => '1',
:showValues => '0',
:anchorSides => '20',
:chartLeftMargin => '10',
:chartRightMargin => '10',
:animation => '0'}
%categories
- @categories.each do |c|
%category{:name => "#{c}"}
%dataset{:seriesName => t('.your_score'), :color => '00A7E2'}
- @categories.each do |date|
- v = @values.detect{|v| v[:date] == date} || nil
- if v && v[:value]
%set{:value => "#{v[:value]}"}
- else
%set
%dataset{:seriesName => t('.minimum_score'), :color => '9D0000', :showAnchors => '0'}
- @categories.size.times do
%set{:value => @minimum_score}
perl code that inserts rails render:
% if ($use_results_management) {
<div id="historical_data_box" title="Performance Feedback Chart">
% use LWP::UserAgent;
% my $browser = LWP::UserAgent->new();
% my $url = 'http://' . $g_siteconfig->get_server_hostname() . "/performance_feedbacks/historical?session_token=" . read_cookie("acs_session");
% my $res;
% eval {
% $res = $browser->get($url);
% };
% if (!$@) {
% print $res->content;
% } else {
% print "Error retrieving the performance feedback chart.";
% }
</div>
<script>
// Historical data dialog.
$("#historical_data_box").dialog({
width: 640, height: 480,
modal: true, autoOpen: false, resizable: false, bgiframe: true,
overlay: { opacity: 0.5, background: "black" },
buttons: {
'Close': function() { $("#historical_data_box").dialog("close"); }
}
});
</script>
----------------------
Any help would be great, I haven't made progress on this issue in days.