Yii Framework Forum: CButtonColumn Buttons - Yii Framework Forum

Jump to content

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

CButtonColumn Buttons Rate Topic: -----

#1 User is offline   GSTAR 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,037
  • Joined: 30-October 09
  • Location:UK

Posted 21 May 2010 - 05:17 AM

I want to hide the "view" button, how can I do this?
0

#2 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,016
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 21 May 2010 - 05:20 AM

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

3

#3 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,197
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 20 November 2010 - 02:38 PM

View PostGSTAR, on 21 May 2010 - 05:17 AM, said:

I want to hide the "view" button, how can I do this?

If you want to hide it permanently, remove it from template property, as Mike showed you.

If you wish to hide it only in certain situations or basing upon some circumstances, use buttons property, add interesting (view) button id there and use visible parameter of its array to pass there a PHP expression which will be then evaluated each time to check whether button should be displayed or not.

Look into my cookbook article for more information on customizing CButtonColumn class.
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#4 User is offline   ThePaulius 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 126
  • Joined: 17-February 12

Posted 06 March 2013 - 05:40 AM

I'm pulling my hair out here, I can't hide any of it.. I've tried:

  • using visible false
  • removing one from the template
  • removing the entire button array


I'm uploading to the correct server too! I had to include a new column just to see if I was looking at the right page!

Is there a deep default somewhere in the bones of YII for forms?

array
		(
			'class'=>'CButtonColumn',
			'template'=>'{view}{update}{delete}',
			'buttons'=>array
			(
				'view' => array
				(
					'url'=>'CController::createUrl("/leads/view", array("id_lead"=>$data->primaryKey))',
				),
				'update' => array
				(
					'url'=>'CController::createUrl("/leads/update", array("id_lead"=>$data->primaryKey))',
				),
				'delete' => array
				(
					'url'=>'CController::createUrl("/leads/delete", array("id_lead"=>$data->primaryKey))',
				),
			),
		),

0

#5 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,686
  • Joined: 04-March 10
  • Location:UK

Posted 06 March 2013 - 05:51 AM

If you remove {view} from the template, the button should disappear. Can you not test the site on your local machine?
0

#6 User is offline   ThePaulius 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 126
  • Joined: 17-February 12

Posted 06 March 2013 - 05:58 AM

I realise what's happening now, the controller is rendering a different page, OMG! :-X so thats why my changes are not showing.

I've gone with 'template'=>'{view}' for now..

I'm off to the 12th floor to find an open window!
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