How to add a toggle button for active inactive in yii cgridview

Page 1

How to Add a Toggle Button for Active Inactive in Yii CGridView In this blog we are going to explain ”how to add a toggle button for active inactive in Yii CGridView”. View the below code and implement this.

1. <?php​ ​ $this​ ­>​ widget​ (​ 'zii.widgets.grid.CGridView'​ ,​ ​ array​ ( 2. ​ 'id'​ =>​ 'subject­grid'​ , 3. ​ 'dataProvider'​ =>​ $model​ ­>​ search​ (), 4. 5. ​ 'columns'​ =>​ array​ ( 6. ​ 'id'​ , 7. ​ 'subjectName'​ , 8. ​ array​ ( 9. ​ 'header'​ =>​ 'Status'​ , 10. ​ 'class'​ =>​ 'CButtonColumn'​ , 11. 12. ​ 'template'​ =>​ '{activate} {rejected}'​ , 13. ​ 'buttons'​ =>​ array​ ( 14. ​ 'activate'​ =>​ array​ (


15. ​ 'label'​ =>​ '<img src="'​ .​ $publishImageUrl​ .​ '">'​ , 16. ​ 'visible'​ =>​ '$data­>status==1'​ , 17. 'url'​ =>​ 'Yii::app()­>createUrl("subject/changestatus",array("id"=>$data ­>id,"status"=>0))'​ , 18. ​ 'options'​ =>​ array​ (​ 'confirm'​ =>​ 'Are you sure want to unpublish?'​ ), 19. 20. ), 21. ....

Read Full Blog:​ ​ how to add a toggle button for active in Yii CGridView You can check more informative blogs and tutorials at php development blogs section and can also browse the​ ​ php developer forum​ for posting and viewing latest questions on php development.


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.