Ajax Load ClistView

Hi All

I have a ajaxLink that opens a zii.widgets.jui.CJuiDialog.

This is a form that adds data to a database.

The form is submitted by a ajaxSubmitButton.

On the same page as the ajaxLink I have a view that has a zii.widgets.CListView to display the data from the database.

How do I get the zii.widgets.CListView to refresh the data when I submit the form from the zii.widgets.jui.CJuiDialog ajaxSubmitButton call.



        echo CHtml::ajaxLink(Yii::t('test','<span>+</span> Add'),$this->createUrl('text/create', array('id'=>$model->id)),array(

            'onclick'=>'$("#testDialog").dialog("open"); return false;',





        <div id="testDialog" style="display: none"></div>


  $this->widget('zii.widgets.CListView', array(



    'template'=>'{items}<div class="p-pager">{pager}</div>',



    'pager' => array (

        'class' => 'CustomLinkPager', 

        'cssFile' => false,

        'maxButtonCount' => 0,





            echo CHtml::ajaxSubmitButton(Yii::t('test','Create'),CHtml::normalizeUrl(array('test/create','render'=>false)),array(


                'success'=>'js: function(data) {

                        if (data.result == "error") {




                        if (data.result == "success") {










On your ajaxSubmitButton you can add ‘complete’ to call an Ajax function to refresh your CListView:

'complete' => 'js:function(){refreshList()}'

You will need a new method in your controller for the Ajax action and a view file to display only the list.