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.

    评论

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大