Postprocessing Clientscripts With Widgets And Ajax

Hey everyone,

I was wondering whether it was possible to postprocess ajax calls to widgets so that the javascript in them is run. Here is my scenario, which might help explain:

I have a page on which I have several instances of a small widget being output (SmallTracker). Each SmallTracker has an ‘expand’ button which uses an ajax call to open up a larger version (LargeTraker) with more information in a modal window (using CJuiDialog). The LargeTracker also has several links on it which open other modals with different information about the business. However, the ajax code in these widgets isn’t firing because I guess the postprocessing doesn’t happen with widgets.

Here is my controller code:


	public function actionAjaxTracker($business_id = null) {

		$business = Business::model()->findByPk($business_id);

		$this->widget('ext.siteElements.largeTrackerDisplay.LargeTrackerDisplay', array('business' => $business));

		Yii::app()->end();

	}

I was wondering if there was any way to postprocess this code? Or should I be using renderpartial and postprocess that, and just put the call to the widget in the rendered view?

Thanks in advance!

Use a controller renderpartial, set the the fourth parameter of renderPartial to true, it will process the clientscript.

doc

That’s what I figured. Thanks zaccaria.