Widget refresh via AJAX Button

Hello,

i have a problem with the standard portlet widget class shiped with yii. I have a site with different widgets and one ajaxSubmitButton which calls a ControllerAction which saves the values of a text area which is embedded into the site. After the saving of the data from this field i what to refresh the status informations inside the portlet widget (the progress of a progressbar should change and a link appear).

How can i solve this? The Portlet class looks like:




class Portlet extends CWidget

{

        public $title;

        public $cssClass='portlet';

        public $headerCssClass='header';

        public $contentCssClass='content';

        public $visible=true;


        public function init()

        {

                if(!$this->visible)

                        return;

                echo "<div class=\"{$this->cssClass}\">\n";

                if($this->title!==null)

                        echo "<div class=\"{$this->headerCssClass}\">{$this->title}</div>\n";

                echo "<div class=\"{$this->contentCssClass}\">\n";

        }


        public function run()

        {

                if(!$this->visible)

                        return;

                $this->renderContent();

                echo "</div><!-- {$this->contentCssClass} -->\n";

                echo "</div><!-- {$this->cssClass} -->";

        }


        protected function renderContent()

        {

        }

}



which is embedded into the site via




$this->widget('Classname',array('visible'=>isset(Yii::app()->session['test']->test)));



The site saves its input field(s) with this Button which calls the controller action "result"




CHtml::ajaxSubmitButton(Yii::t('Test', 'Speichern'), CHtml::normalizeUrl(array('aspeichern')), array('update' => '#result'), array('name'=>'buttonspeichern'));



My knowledge about AJAX is very limited, i hope you can help me.

Regards

Martin

The action ‘aspeichern’ should produce exactly the content that you want to appear in the widget, so it will do smth like $this->renderPartial() or $this->widget(); or smth like that.

An advice is to call this action by siply writing the url in your browser, and check if it is producing the expected output.

When you are sure that your action is ok, your CHtml::ajaxSubmitButton will work of corse.