我已经使用highcharts设置了一些图表,使用辉煌的'gon'宝石来填充它的系列栏目。现在,我试图用ajax更新它的结果。使用ajax for rails更新highcharts
这里是我的设置是什么样子:
user_controller:
gon.segmentedData = ActiveRecord query here..
的application.js
var weekly_options = { //Some standard highcharts options here
series: gon.segmentedData
};
这使得图表完美。我想用以下行动
以ajaxify这个图表:
<div class = deposit>
<%= form_tag transact_path, :remote => true, :validate => true, :method => :post do %>
.
.
.
<%= submit_tag "Deposit", :id => 'deposit_button', :class => 'round', :disable_with => 'Please wait..' %>
及最新的数据图表,我重新填充在transaction_controller的创建行动
transaction_controller系列数据
def create
gon.segmentedData = ..
end
个create.js:
var options = //here i pass all the options again
new Highcharts.Chart(options);
我的问题是,我无法获得更新的设置选项通过transaction_controller到create.js。同样的图表再次呈现。
非常感谢,如果有人可以批评这种方法对我来说。
谢谢!看起来很有希望! – Rahul 2012-04-06 04:23:34