Yii Framework Forum: extend CGridColumn - Yii Framework Forum

Jump to content

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

extend CGridColumn Rate Topic: -----

#1 User is offline   dimis283 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 277
  • Joined: 24-January 09

Posted 10 February 2010 - 09:29 AM

I want to extend the CGridColumn so depending on the user who is log in not to be seen the update etc buttons.
I make this but now no buttons are there what is wrong?
$this->widget('zii.widgets.grid.CGridView', array(
	'dataProvider'=>$dataProvider,
	'columns'=>array(
		
		'CUSTOMER_NAME',
		array(
			'class'=>'application.components.MyButtonColumn',
		),
	),
));
......
class MyButtonColumn extends CGridColumn{
  //  public $template='{view} {update} {delete}';
   public function init()
	{  
     //  if (Yii::app()->user->name!='admin')
          //     $this->template='{view} {update} {delete} ';
     parent::init();
   }
}

Posted Image
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,875
  • Joined: 04-October 08
  • Location:DC, USA

Posted 10 February 2010 - 09:50 AM

You need to call parent::init() first.
0

#3 User is offline   dimis283 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 277
  • Joined: 24-January 09

Posted 10 February 2010 - 10:08 AM

I solve it.
Thank you. :rolleyes:
I am happy working with Yii
Posted Image
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