Update Portlet In Sidebar Using Ajax In Another View

I need to update portlet in sidebar using the CHtml ajaxsubmitbutton in another view.

I am not sure if this was answered before now.

and example might help here even hypothetical example

For example:

I have a form (view) that uses the ajaxsubmitbutton to add selected item(s)- displaying item name and price - to a gridview. each new addition causes the gridview to be refreshed. At the same time I want to update a shopping cart portlet with the number of items selected and the total price of the same selected items.

when you send the data to the server after updating the gridview use same info to update the items and price paste your code if you want me to give you example

Please see the attachment.

paste your view and controller both and dont attach just paste it and highlight it

Here is the code for updating the repair table after the user select a job from a dropdownlist using ajaxsubmitbutton:

public function actionJobProcess() {

	$model=new Repairdetails;


	


	if(isset($_POST['job'])){


		$job = $_POST['job'];


		


		$this->jobs($job);


		$model->JobID = $this->job_id;


		$model->RepairID = Yii::app()->session['repair_id'];


		$model->UnitPrice = $this->list_price;


		if($model->save()){


		echo "Ok";


		}


		else{


		throw new Exception("Sorry, cant create a Repair Job",500);


		}


	}


}

Then I have a myql view that select the rows in the repair table and calculate the extended price. In yii I created a model based on the view. It is this view I am displaying in the gridview using the following code on the above ajaxsubmitbutton:

<?php

echo CHtml::ajaxSubmitButton('Select',


	array('shoerepair/jobprocess'),


	array('success'=&gt;'function() {


            &#036;.fn.yiiGridView.update(&quot;dropoff-grid&quot;);


    }'),


	array(


		'id'=&gt;'ajaxSubmitBtn2',


		'name'=&gt;'ajaxSubmitBtn2')


		); 


	?&gt; 

<?php

$this->widget(‘zii.widgets.grid.CGridView’,array(

‘id’=>‘dropoff-grid’,

‘dataProvider’=>Vrepdetails::model()->search(),

‘columns’=>array(

	array('name'=&gt;'',


	'type'=&gt;'raw',


	'value'=&gt;'CHtml::Link(&quot;Delete&quot;)'


	),


	array(


      'name'=&gt;'RepairdetailID',


      'visible'=&gt;false


        ),


	'Name',


	'Qty',


	'UnitPrice',


	'Discount',


	


	array(


    'name'=&gt;'ExtendedPrice',


    'footer'=&gt;&quot;Repair Total: &quot;.Vrepdetails::model()-&gt;fetchTotalPrice(Vrepdetails::model()-&gt;search()-&gt;getData()),


    ),


	),

));

?>

Here is the respective code in the Vrepdetails model associated with the view:

public function search()

{


	// Warning: Please modify the following code to remove attributes that


	// should not be searched.





	&#036;criteria=new CDbCriteria;





	&#036;criteria-&gt;compare('RepairdetailID',&#036;this-&gt;RepairdetailID);


	&#036;criteria-&gt;compare('Name',&#036;this-&gt;Name,true);


	&#036;criteria-&gt;compare('RepairID',&#036;this-&gt;RepairID);


	&#036;criteria-&gt;compare('Qty',&#036;this-&gt;Qty);


	&#036;criteria-&gt;compare('UnitPrice',&#036;this-&gt;UnitPrice,true);


	&#036;criteria-&gt;compare('Discount',&#036;this-&gt;Discount,true);


	&#036;criteria-&gt;compare('ExtendedPrice',&#036;this-&gt;ExtendedPrice,true);


	


	return new CActiveDataProvider(&#036;this, array(


		'criteria'=&gt;array('condition'=&gt;'RepairID='.Yii::app()-&gt;session[&quot;repair_id&quot;],)


	));


}








public function fetchTotalPrice(&#036;records)


{


    &#036;price=0;


    foreach(&#036;records as &#036;record)


            &#036;price+=&#036;record-&gt;ExtendedPrice;


    return &#036;price;


}  

I also want to show the total price also in a portlet in the sidebar.

I solved the problem by using clips and using an action in the controller.