weixin_33737774 2014-03-06 15:27 采纳率: 0%
浏览 11

Yii vs Highcharts vs Ajax

here is a part of my view:

<?php
echo CHtml::dropDownList('al_ev_id', $model->al_ev_id,$listaDateAl,
                              array(
                                 'ajax' => array(
                                 'type'=>'POST',
                                 'url'=>CController::createUrl('stat/ajaxStoricoSubDetails'),
                                 'update'=>'#storicoSubDetails',
                                 ),
                                 'class' => 'rowform',
                        ));
...
?>
<div id="storicoSubdetails">
...
<?php
$this->Widget('ext.highcharts.HighchartsWidget', array(
   'options'=>array(
      'title' => array('text' => 'A title'),
      'xAxis' => array(
         'categories' => $model->streamLabel
      ),
      'yAxis' => array(
         'title' => array('text' => 'another title')
      ),
      'series' => array(
         array('name' => $model->labelGraph, 'data' => $model->streamData)
      )
   )
));     

?>
...
</div>

the controller in the action 'ajaxStoricoSubDetails' reload the same $this->Widget('ext.highcharts.HighchartsWidget' etc, etc

the objective of this code is to update the starting x-value of the graph, modifying it with the dropdown

and here is my problem:

the first rendering of highcharts graph is ok; but, when I change the value in the DropDown, thus starting the ajax part, graph is not rendered

highcharts return an error 16 code, that means

Highcharts already defined in the page

in fact in the second rendering code (the ajax fired part) I find

<script src="http://code.highcharts.com/highcharts.js"></script>

that I think is the problem

is there any way to avoid this

Any other suggestions?

  • 写回答

1条回答 默认 最新

  • 10.24 2014-03-06 15:35
    关注

    It's not the best long term solution, but...

    If <script src="http://code.highcharts.com/highcharts.js"></script> is at the top of your page now, move it in <div id="storicoSubdetails"> instead.

    That way the script reference should be overwritten when the ajax stuff reloads everything in the storicoSubdetails div, and you will only have 1 script reference on the page.

    评论

    报告相同问题?

    悬赏问题

    • ¥15 我不明白为什么c#微软的官方api浏览器为什么不支持函数说明的检索,有支持检索函数说明的工具吗?
    • ¥15 ORBSLAM2框架跑ICL-NUIM数据集
    • ¥15 在我想检测ros是否成功安装时输入roscore出现以下
    • ¥30 老板让我做一个公司的投屏,实时显示日期,时间,安全生产的持续天数,完全没头绪啊
    • ¥15 Google Chrome 所有页面崩溃,三种解决方案都没有解决,我崩溃了
    • ¥20 使用uni-app发起网络请求,获取重定向302返回的cookie
    • ¥20 手机外部浏览器拉起微信小程序支付 (相关搜索:微信小程序)
    • ¥20 怎样通过一个网址找到其他同样模版的网址
    • ¥30 XIAO esp32c3 读取FDC2214的数据
    • ¥15 在工控机(Ubuntu系统)上外接USB蓝牙硬件进行蓝牙通信