how to add gridview with button

I want to make a grid view with edit view delete and 1 extra button can some one give me a sample code for this,

what i need is a complete code for view and controller thanks a lot ::)

you can add another column in gridview with a link like so for controller just add an action

'columns' => [



            'header' => 'Action',

            'value' => 'CHtml::link("reorder", ["/order/reorder/".$data->id])',

            'type' => 'html',


        // ...


// in your controller

public function actionReorder($id) {

 // code ...


You may replace you cgridview Cbutton array like following




      'buttons' => array( 

        'view' => array(

        'label' => '<i class="en-vcard mr10"></i>', // text label of the button


        'options'=>array('class'=>'view', 'title'=> 'View Profile'),

        'url' => 'CHtml::normalizeUrl(array("/profile/profile/view/id/".$data->profile->user_id."/"))'


      'delete' => array(

        'label' => '<i class="fa-trash"></i>', // text label of the button


        'options'=>array('class'=>'delete', 'title'=> 'Delete from Department'),

        'url' => 'CHtml::normalizeUrl(array("your/url/to/page"))',


            var elem = $(this);

            $.fn.yiiGridView.update('listMem-grid', {  //change my-grid to your grid's name



            beforeSend: function(){

              elem.html('<i class=fa-spinner rotate></i>');


            success:function(data) {

                $.fn.yiiGridView.update('listMem-grid') //change my-grid to your grid's name



      return false;}"