1
votes

i checked 1000 times my code all things okey ! but after i change my theme ! its not send ajax request for filtering grid view when i checked this code i thought is okey and i should say that i searched and check wiki yii but i couldnt find my problem

my view Code:

 <?php $this->widget('zii.widgets.grid.CGridView', array(
        'id' => 'product-grid',
        'itemsCssClass' => 'table table-bordered table-striped dataTable',
        'dataProvider' => $model->notDeleted()->search(),
        'filter' => $model,
        'columns' => array(
            'appId',
            array(
                'name' => 'categoryId',
                'value' => '$data->category->name',
                'filter' => CHtml::activeDropDownList($model, 'categoryId', CHtml::listData(Category::model()->notDeleted()->findAll(), 'id', 'name'),
                    array('empty' => '')

                )
            ),
            'name',
            'packageName',
            'price',
            'discount',
            'version',
            array(
                'name' => 'isActive',
                'value' => '$data->isActive ? Yii::t("app", "Yes") : Yii::t("app", "No")',
                'filter' => CHtml::activeDropDownList($model, 'isActive', array(
                    1 => Yii::t('app', 'Yes'),
                    0 => Yii::t('app', 'No'),
                ))
            ),
            array(
                'name' => 'inAppPurchase',
                'value' => '$data->inAppPurchase ? Yii::t("app", "Yes") : Yii::t("app", "No")',
                'filter' => CHtml::activeDropDownList($model, 'inAppPurchase', array(
                    1 => Yii::t('app', 'Yes'),
                    0 => Yii::t('app', 'No'),
                ))
            ),
            /*
            'createUserId',
            'createTime',
            'isDeleted',
            */
            array(
                'class' => 'CButtonColumn',
            ),
        ),
    )); ?>

and my controller:

 $model = new Product('search');
    $model->unsetAttributes(); // clear any default values
    if (isset($_GET['Product']))
        $model->attributes = $_GET['Product'];

    $this->render('admin', array(
        'model' => $model,
    ));

please help me !

1
try - 'dataProvider' => $model->search() have you primary key in your db table? - Rohit Suthar

1 Answers

-1
votes

For the next one, I had the same problem. I proceeded like this and it worked. for my case I delete

<script src="<?php echo Yii::app()->theme->baseUrl; ?>/js/jquery-1.11.1.min.js">
</script>

Check if you included jquery.js more than once in your page. I had the same error and the reason was that yii had already added the jquery.js script, so no need to include it yourself.

Cr.Andrey Zausaylov https://stackoverflow.com/a/41304449/3032180