Page Scope In Widgets


I’m very new to Yii and to web development in general. I have a view where I’m trying to display the contents of many instances of the same model (which is very straight forward). But for each model instance, I have a dropdown list that uses ajax to change what part of the inner model to display. i.e. my model has a pair of children objects, and the dropdown box will select which child to display. My problem is that when I make a selection in one of the dropdown boxes, the ajax call to the controller is called for all model instances, and the response isn’t isolated to the view with the dropdown box that made the call and so the view of all the model instances ends up with the same content for the child view. I’ve tried to implement it in a widget hoping the variable scope would be contained, but it still has the same behavior. Is there something I can do to contain the scope so that the partial view that displays the content for the child object is only refreshed when the ajax returns and not the whole page?

The view that shows each model instance with the dropdown box and ajax is very simple. It is called by the CListView widget for each instance:

<?php echo CHtml::dropDownList('applicationSummary', $selected->application_type, CHtml::listData($applications, 'application_id', 'application_type'),


      'ajax' => array(

      'type' => 'POST',

      'url' => CController::createUrl('application/summary'),

      'update' => '#summary_info',


   ))); ?>

<div id="summary_info">

   <?php $this->renderPartial('/application/_applicationsummary', array('selected'=>$selected), false, true); ?>


And the controller method contains this:

public function actionSummary()


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

      $selected = Application::model()->findByPk($_POST['selected']);			

      $this->renderPartial('_applicationsummary', array('selected'=>$selected), false, true);



Am I on the right track or is there some other technique I have to use? I just need my callback to refresh the partial view the selection was made in and not the whole page. I’ve seen a lot of posts and examples about the scripting but haven’t found anything where there were many instance of script on the same page.

Thanks for anything anyone can provide.