Yii Framework Forum: Cbuttoncolumn - Property "cgridview.0" Is Not Defined. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Cbuttoncolumn - Property "cgridview.0" Is Not Defined. Rate Topic: -----

#1 User is offline   coolPhp 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 15-December 10

Posted 19 November 2012 - 04:56 AM

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
0

#2 User is offline   KonApaz 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,305
  • Joined: 21-February 11
  • Location:Greece

Posted 19 November 2012 - 05:16 AM

check that removing step by step all the properties of CButtonColumn.
Then post again property that has problem
Yii is the best php framework in the world!
find our demo Yii extension on www.webkit.gr
Is it post useful? please v++ ;)
0

#3 User is offline   coolPhp 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 15-December 10

Posted 19 November 2012 - 05:35 AM

View PostKonApaz, on 19 November 2012 - 05:16 AM, said:

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.
0

#4 User is offline   Reza m 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 148
  • Joined: 07-March 12

Posted 19 November 2012 - 05:43 AM

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
0

#5 User is offline   KonApaz 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,305
  • Joined: 21-February 11
  • Location:Greece

Posted 19 November 2012 - 05:56 AM

View PostcoolPhp, on 19 November 2012 - 05:35 AM, said:

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.


check temporarly the code as it described here:
http://www.yiiframew...i/1.1/CGridView
Yii is the best php framework in the world!
find our demo Yii extension on www.webkit.gr
Is it post useful? please v++ ;)
0

#6 User is offline   coolPhp 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 15-December 10

Posted 19 November 2012 - 06:15 AM

View PostReza m, on 19 November 2012 - 05:43 AM, said:

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


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>

0

#7 User is offline   coolPhp 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 15-December 10

Posted 19 November 2012 - 08:40 AM

View PostcoolPhp, on 19 November 2012 - 06:15 AM, said:

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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users