4

I cannot figure out how to get the html/javascript loading correctly. Thus highcharts doesnt have the correct div loaded to render the chart when it is run.

I have a menu partial:

<ul class='kwicks kwicks-vertical'>
    <li id='panel-1'><%= link_to_unless_current image_tag('keyIssues.png'), load_key_issues_path, remote: true %></li>
    <li id='panel-2'><%= link_to_unless_current image_tag('pollVsLeader.png'), load_polls_path, remote: true  %></li>
</ul>

That when called runs a method home_controller.rb:

def load_key_issues
    respond_to do |format|
        format.js
        format.html { render :action => "refresh", :notice => 'Update SUCCESSFUL!' }
    end
end

That then runs load_key_issues.js.erb:

$("#replace").html("<%= j render partial: 'shared/key_issues' %>");

Which then renders this html in a partial:

<div class="col span_6_of_7">
    <section id="infographic">
        <div id ="infographicContent">
            <%= javascript_include_tag "highcharts" %>
            <%= javascript_include_tag "chart" %>
            <div id="chart" style="min-width: 310px; height: 700px; margin: 0 auto"></div>
        </div>
    </section>  
</div>

I don't know how to get this sequence correct, can anyone be of assistance please?

4

1 回答 1

4

在要加载部分的主页中包含您的 javascript。

于 2014-02-18T03:43:16.407 回答