Highcharts, Yii And Body Content Reloading
Solution 1:
//init
$('#container').highcharts({});
//select onchange
$('#container').highcharts().destroy();
Solution 2:
As following the error link says
Highcharts already defined in the page
This error happens the second time Highcharts or Highstock is loaded in the same page, so the Highcharts namespace is already defined. Keep in mind that the Highcharts.Chart constructor and all features of Highcharts are included in Highstock, so if you are running Chart and StockChart in combination, you only need to load the highstock.js file.
You are loading the highcharts javascript twice. You can try
a) enabling highcharts on the first load and then disabling it on the next e.g perhaps checking if ajax
b) use custom javascript to check whether highcharts has been loaded as in this blog post
c) use the NLSClientScript extension that handles js and css loading for you
I suggest you use the last one. I was bitten by this problem a couple of times until I discovered it. It eliminates the need to single out each javascript function/file.
EDIT
Instead of editing the listview js, you can edit your code to use the same update
function:
<?phpecho CHtml::dropDownList('usage', 'cg', array(
'd'=>'Daily',
'm'=>'Monhly'
), array(
'onChange'=>'$.fn.yiiListView.update("your-list-id", {
data: {"usage":$(this).val()},
type: "POST"
});'
));
?>
Post a Comment for "Highcharts, Yii And Body Content Reloading"