Yiic Grid视图总是给予直播不是一个功能 [英] Yiic Grid view always giving live is not a function

查看:68
本文介绍了Yiic Grid视图总是给予直播不是一个功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 live 已被弃用。现在我正在使用Yii网格视图,我有以下代码:

I know live has been deprecated. Now I am using Yii grid view and i have following code:

   $this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'category-grid',
    'dataProvider' => $model->search(),
    'filter' => $model,
    'columns' => array(
        'title',
        array(
            'class' => 'CButtonColumn',
            'viewButtonUrl' => 'Yii::app()->createUrl("/shop/category/view",
            array("id" => $data->category_id))',
            'updateButtonUrl' => 'Yii::app()->createUrl("/shop/category/update",
            array("id" => $data->category_id))',
            'deleteButtonUrl' => 'Yii::app()->createUrl("/shop/category/delete",
            array("id" => $data->category_id))',
        ),
    ),
));

在浏览器上它给我错误:

On the browser it gives me error:

typeError: jQuery(...).live is not a function
[Break On This Error]   

jQuery('#category-grid a.delete').live('click',function() {

我很困惑,因为我已搜索整个文件夹中的.live功能,但我找不到。请帮助!

I am confused as i have searched the entire folder for .live function but i cant find it. Please help!

推荐答案

我认为这是因为Yii的版本。它可能正在使用 .live(),这已被弃用。

I think this is because of the version of Yii. It may be using .live() which is deprecated.

一个可能的解决方案是你可以转到 yii / framework / zii / widgets / grid 并编辑 CButtonColumn.php

One Possible solution can be you go to yii/framework/zii/widgets/grid and edit CButtonColumn.php

在此替换 .live() .on()

我认为它应该有效。

这篇关于Yiic Grid视图总是给予直播不是一个功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆