Skip to content Skip to sidebar Skip to footer

Yiic Grid View Always Giving Live Is Not A Function

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',

Solution 1:

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

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

In this replace .live() by .on()

I think then it should work.

Solution 2:

live function of jquery is depreciated ... if u are using different version of jquery than the yii's built in ... show documentation of jquery for live() method ... use .on() or .delegate() method instead ... i'm not sure ... but it can be a one solution if u are using other jquery version than the buit in...

from this page Jquery live() documentationAs of jQuery 1.7, the .live() method is deprecated. Use .on() to attach event handlers. Users of older versions of jQuery should use .delegate() in preference to .live().

so it will not work forjquery version >= 1.7

Solution 3:

You can re-write the default javascript action by doing this

        //I a'm commenting your delete url config
        //'deleteButtonUrl' => 'Yii::app()->createUrl("/shop/category/delete",array("id" => $data->id))',
        'buttons' => array(
            'delete' => array(
                'url'=>'Yii::app()->createUrl("/shop/category/delete",array("id" => $data->id))',
                'click' => 'js:function(evt)'
                . '{'
                . 'evt.preventDefault();'
                . 'alert("Your functionality Will Come here. Or Call a function");'
                . '}'
            ),
        )

Post a Comment for "Yiic Grid View Always Giving Live Is Not A Function"