Sunday, 15 January 2012

javascript - Refreshing view on droplist onchange and keeping state -



javascript - Refreshing view on droplist onchange and keeping state -

i have view contains user data, clistview info fetched database, representing requests log (ip, key, date/time) , custom highcharts widget draws chart based on data.

the clistview renders info without grouping, is, it's 1:1 representation of saved in database.

the highcharts widget should render info grouping day, month or year.

i noticed clistview capable of re-rendering entire page without reloading , doing ajax request (which haven't implemented in controller).

is possible create single dropdownlist widget trigger same ajax request , create controller's action respect selected value?

this controller's action:

public function actionuser($id) { $usuario = user::model()->with('contract')->findbypk($id); $contract = new carraydataprovider($usuario->contract, array( 'keyfield'=>'idkey' )); $usage = new carraydataprovider($user->usage, array( 'keyfield'=>'idusage', 'pagination'=>array( 'pagesize'=>15 ) )); $this->render('user',array( 'user'=>$user, 'contract'=>$contract, 'usage'=>$usage )); }

and dropdownlist widget

<?php echo chtml::dropdownlist('graph', 'gr', array( 'd'=>'daily', 'm'=>'monthly', 'y'=>'yearly' )); ?>

i recommend send ajax request controller info , homecoming json formatted info view. re-rendert highchart new data.

javascript ajax yii highcharts

No comments:

Post a Comment