PHPSOFT SOLUTIONS LOGO
  • Home
  • About Us
  • Contact Us
  • Contact Us
  • Blog
  • Online Courses
  • Contact US

Yii add new action button to CGridView

In admin grid listing of any controller, we can add a custom action button along with viiew, update and delete.follow the steps:

1. open admin file where your cgridview code is written.
2. edit array(
‘class’=>’CButtonColumn’,
),
to

array
(
‘class’=>’CButtonColumn’,
‘template’=>'{view}{update}{delete}{setattributes}’,
‘buttons’=>array
(
‘setattributes’ => array
(
‘url’=>’Yii::app()->createUrl(“categories/setAttributes”, array(“id”=>$data->id))’,
),
),
),

Params for new button  are:

buttonID' => array
(
    'label'=>'...',     //Text label of the button.
    'url'=>'...',       //A PHP expression for generating the URL of the button.
    'imageUrl'=>'...',  //Image URL of the button.
    'options'=>array(), //HTML options for the button tag.
    'click'=>'...',     //A JS function to be invoked when the button is clicked.
    'visible'=>'...',   //A PHP expression for determining whether the button is visible.
)

 

Posted on May 2013
Category: Yii

Categories

  • Blog
  • phonegap
  • PHP Frameworks
  • php-jquery
  • system
  • Wordpress
  • Yii

Post navigation

Previous post

How to create Yii first app

Next post

Include jquery in yii


PHPSOFT SOLUTIONS LOGO

Our mission is to satisfy our customers to the best.Money is the source nowdays, the trust of how we can use your money in the best way is build by us.The core value of php soft solutions is to provide the best service to our customers in a great manner.

Contact

PLOT NO. C157, The Groove, Industrial focal point, Phase7,MOHALI, SAS Nagar, Punjab, 160055

8146501814

contact@phpsoftsolutions.in

Pages Links
  • WordPress
  • Yii
  • PHP Frameworks
  • php-jquery
  • system
  • phonegap

© 2025 PHPSOFT SOLUTIONS