phpjqueryajaxyiijquery-bbq

Yii jQuery BBQ error after delete


I am using Yii CGridView. There is delete buttons in a column:

array(
    'class'=>'CButtonColumn',
    'template' => '{update}{delete}',
    'buttons' => array(
        'delete' => array(
            'imageUrl' => false,
            'options' => array( 'class'=>'btn btn-danger btn-mini delete-button' ),
        )
    ),
)

After clicking delete button i see ajax request and directly after that I got js error

"URL is undefined" from jquery.ba-bbq.js @ 257 line (matches = url
 .match( is_fragment ? /^([^#]*)\#?(.*)$/ : /^([^#?]*)\??([^#]*)(#?.*)/ );).

Does anyone have any idea how to get rid of that error?

P.s. entry is deleted, only js error.


Solution

  • Ok, i found solution here :

    Overwrite CGridView registerClientScript with this one:

    public function registerClientScript(){
    
        //if ajaxUrl not set, default to the current action
        if(!isset($this->ajaxUrl))
            $this->ajaxUrl = Yii::app()->controller->createUrl("");
    
        //call parent function
        parent::registerClientScript();
    }