Yii 1.1.11 CListView Before/ After AjaxUpdate Bug

Hi,

we think we have found a bug in CListView. The beforeAjaxUpdate function has not worked after update to Yii 1.1.11. We have solved the issue as follows:

From


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

		{

			if(!($this->afterAjaxUpdate instanceof CJavaScriptExpression) && strpos($this->afterAjaxUpdate,'js:')!==0)

			{

				$options['beforeAjaxUpdate']=new CJavaScriptExpression($this->afterAjaxUpdate);

			}

			else

			{

				$options['beforeAjaxUpdate']=$this->afterAjaxUpdate;

			}

		}

To


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

		{

			if(!($this->afterAjaxUpdate instanceof CJavaScriptExpression) && strpos($this->afterAjaxUpdate,'js:')!==0)

			{

				$options['afterAjaxUpdate']=new CJavaScriptExpression($this->afterAjaxUpdate);

			}

			else

			{

				$options['afterAjaxUpdate']=$this->afterAjaxUpdate;

			}

		}

Thanks for reporting this.

It has already been fixed in recent github code: https://github.com/yiisoft/yii/commit/1f073f855d87a0536aa3599a85a9a6f1d94d986d

Similar bug can be found in zii.widgets.grid.CGridView [line: 429]


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

{

    if((!$this->ajaxUpdateError instanceof CJavaScriptExpression) && strpos($this->selectionChanged,'js:')!==0)

    {

	$options['selectionChanged']=new CJavaScriptExpression($this->selectionChanged);

    }

     else

    {

        $options['selectionChanged']=$this->selectionChanged;

    }

}

where the correct code should be


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

{

    if((!$this->selectionChanged instanceof CJavaScriptExpression) && strpos($this->selectionChanged,'js:')!==0)

    {

	$options['selectionChanged']=new CJavaScriptExpression($this->selectionChanged);

    }

     else

    {

        $options['selectionChanged']=$this->selectionChanged;

    }

}

Already fixed in the CGridView too.