简体   繁体   English

删除后Yii jQuery BBQ错误

[英]Yii jQuery BBQ error after delete

I am using Yii CGridView . 我正在使用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 单击删除按钮后,我看到一个ajax请求,然后直接得到js错误

"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? 有谁知道如何摆脱这个错误?

Ps entry is deleted, only js error. ps条目被删除,只有js错误。

Ok, i found solution here : 好的,我在这里找到了解决方案:

Overwrite CGridView registerClientScript with this one: 用以下代码覆盖CGridView registerClientScript

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();
} 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM