Yii CGridview Tutorials

Yii Gridview CButtonColumn

CButtonColumn used to renders one or more buttons in gridview columns. Basically cgridview column have three buttons. They are “view”, “update”, “delete” button and it have corresponding actions. We can change it using CButtonColumn properties.TemplateShow the button using template string using below format'template'=>'{view}{update}{delete}',We can add more buttons here.afterDeleteAfter deleted the row, We can do some action using afterDelete.deleteButtonImageUrlChange the delete button image url using deleteButtonImageUrldeleteButtonLabelChange the delete button label using […]... Read More »

Yii CGridview Button Configuration

In this article, I explained about Cgridview “CButtonColumn” of yii framework.Here I have added new button and assigned customized url to new button. We can change the url to “view”,”update”,”delete” button also. <?php $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'user-grid', 'dataProvider'=>$model->search(), 'columns'=>array( 'username', 'type', array( 'class'=>'CButtonColumn', 'template'=>'{view}{update}{delete}{newbutton}', 'buttons'=>array( 'newbutton'=>array( 'label'=>'Click', 'url'=>'Yii::app()->createAbsoluteUrl('controller/action') )', 'visible'=>'$data["type"]=="admin"?false:true', ), ), ), ), ); ?>... Read More »

CGridview CButtonColumn Visible Status

We can change the cgridview CButtonColumn visible status based on condition. Here i explained to show and hide the action buttons. using “visible” tag We can do this. To show the button set ‘true’ to visible and to hide the button set ‘false’ to visible. array( 'class'=>'CButtonColumn', 'header' => 'List of Actions', 'template'=>'{view}{update}{delete}{User}', 'buttons'=>array( 'User'=>array( 'lable'=>"User", 'url'=>'', 'visible'=>'$data["status"]==0?true:false', ), 'update'=>array( 'visible'=>'$data["status"]==0?true:false', ), 'delete'=>array( 'visible'=>'$data["status"]==0?true:false', ), ), ),... Read More »

How To Handle CGridview in Yii

CGridview Basic CGridview With User MethodsCGridview Css StyleCGridview CButtonColumnCGridview AjaxCGridview enableSortingImages In CGridviewLink In CGridviewCGridview Summary TextPagination Header Text And Override Pagination CSSEmpty Result TextCGridview After DeleteSupport FilesCGridview Pagination TextColumn Header In CGridviewRow Selection Or Click Event In CGridViewAdd Css Class To CGridView Table RowAdd Class Or Style For CGridView Header CellAdd Css Class To CGridView Table ColumnCGridview Filter : DropDown ListCGridView Filter: DatepickerCGridview BasicHint – For Html: When display the date, […]... Read More »