Cbuttoncolumn - Property "cgridview.0" Is Not Defined.

Can someone please tell me how to fix this error I am getting.


Property "CGridView.0" is not defined. 




$this->widget('zii.widgets.grid.CGridView', array(

    'id'=>'user-grid',

    'dataProvider'=>$model->search(),

    'filter'=>$model,

	'enablePagination'=>true,

    'columns'=>array(

        'id',

        'name',

        'description',

        'version'

        ),

		array(

			'class'=>'CButtonColumn',

			'template'=>'{down}',

			'buttons' => array(

				'down'=>array(

					'label'=>'Display',     //Text label of the button.

					'click'=>'displaypdf("<?=$data->file->url?>")', //HTML options for the button tag.

					'visible'=>'true',   //A PHP expression for determining whether the button is visible.

				),

			),

		),

));



It works fine when I remove the array




array(

			'class'=>'CButtonColumn',

			'template'=>'{down}',

			'buttons' => array(

				'down'=>array(

					'label'=>'Display',     //Text label of the button.

					'click'=>'displaypdf("<?=$data->file->url?>")', //HTML options for the button tag.

					'visible'=>'true',   //A PHP expression for determining whether the button is visible.

				),

			),

		),



Thanks

check that removing step by step all the properties of CButtonColumn.

Then post again property that has problem

It gives me the error even if I only have this there.




array(

			'class'=>'CButtonColumn',

		),



I have to remove the array for it to work.

use this:




$this->widget('zii.widgets.grid.CGridView', array(

    'id'=>'user-grid',

    'dataProvider'=>$model->search(),

    'filter'=>$model,

        'enablePagination'=>true,

    'columns'=>array(

        'id',

        'name',

        'description',

        'version',

        array(

            'class'=>'CButtonColumn',

            'template'=>'{down}',

            'buttons' => array(

            'down'=>array(

                    'label'=>'Display',     //Text label of the button.

                    'click'=>'displaypdf("<?=$data->file->url?>")', //HTML options for the button tag.

                    'visible'=>'true',   //A PHP expression for determining whether the button is visible.

                    ),

                ),

            ),

        )

));



it’s an issue with pranteses , you should remove “)” after version column and add it after button column

check temporarly the code as it described here:

http://www.yiiframework.com/doc/api/1.1/CGridView

ok thanks but my "onclick" ja function is not getting put into the display link now, and not getting called.

the html in the browser is just show as


<a href="#" title="Display">Display</a>

it is also trying to open


<?=$data->file->url?>

on the load which it needs to open on the click.

can someone help.