Yii Framework Forum: Cgridview Removing The View/edit Buttons & Column Of Widget - Yii Framework Forum

Jump to content

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

Cgridview Removing The View/edit Buttons & Column Of Widget zii.widgets.grid.CGridView - modify widget Rate Topic: -----

#1 User is offline   Tanya_new_2_yii 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 44
  • Joined: 10-March 13

Posted 15 March 2013 - 01:38 PM

Hello,

I am currently trying to use the CGridView (zii.widgets.grid.CGridView) widget in Yii. My data loads fine, but I would like to modify the widget in order to not have the last column which allows for the database entries which populate the table to be viewed/modified.

I am new to Yii, and am inexperienced. Hoping someone understands what I wish to do, and could instruct me on which lines of code to remove/modify. I have attached an image in the hopes of demonstrating what I am trying to do ..I would like to remove column 3 completely from my table (including the buttons & their functionality in column 3).

I'm not even sure which file to modify or how :S (up to now, I've been modifying the _search.php & admin.php pages in "/protected/views/model")

Thank you in advance for your help!!!!
Tanya

Attached File(s)


0

#2 User is offline   seenivasan 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 620
  • Joined: 17-June 12
  • Location:Chennai,TamilNadu,India.

Posted 15 March 2013 - 02:16 PM

Dear Friend

In views/model/admin.php, look for the following under columns inside CGridView widget

and remove it.

array(
	'class'=>'CButtonColumn',
		
		),


By default template property of CButtonColumn has following three options.
$template='{view} {update} {delete}';


If we want to allow the users only to view the files, we can modify the column in the following way.

array(
		'class'=>'CButtonColumn',
		'template'=>'{view}'
		),


Regards.
1

#3 User is offline   Tanya_new_2_yii 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 44
  • Joined: 10-March 13

Posted 19 March 2013 - 01:20 PM

Works great (problem solved)! Thank you!
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