mycheckboxcolumn extension to make CCheckBoxColumn selected by default, depending from row to row

  1. Documentation
  2. Change Log

NOTE: As of Yii version 1.1.4 the checked attribute is added to the core, so this extension is NOT NEEDED.

myCheckBoxColumn extends CCheckBoxColumn in CGridView and adds the attribute 'checked' to the column properties so that the checkbox column can be selected from row to row depending on the evaluation of this attribute.

'checked' is a string expresion that need to evaluate to true or false, if evaluates to true the checkbox will be selected otherwise will NOT be selected.

Documentation

Requirements
  • Yii 1.0 or above
Installation
  • Extract the release file under protected/components
Overview

myCheckBoxColumn extends CCheckBoxColumn in CGridView and adds the attribute 'checked' to the column properties so that the checkbox column can be selected from row to row depending on the evaluation of this attribute.

'checked' is a string expresion that need to evaluate to true or false, if evaluates to true the checkbox will be selected otherwise will NOT be selected.

Usage

Use it like CCheckBoxButton

<?php
$this->widget('zii.widgets.grid.CGridView', array(
  'dataProvider'=>$dataProvider,
  'columns'=>array(
    array(
      'class'=>'myCheckBoxColumn',
      'checked'=>'$model->count>100',
    ),
    'name',
    'type',
  ),
));
?>

In the above example all rows with $model->count bigger than 100 will have the checkbox selected.

Some more examples for this attribute:

'checked'=>'true'
-
 'checked'=>'$model->createdby==Yii::app()->userid'
-
 'checked'=>'"checked"'

Change Log

April 15, 2010
  • Initial release.
3 0
3 followers
744 downloads
Yii Version: 1.1
License: (not set)
Category: User Interface
Tags:
Developed by: Maurizio Domba Cerin
Created on: Apr 15, 2010
Last updated: 13 years ago

Downloads

show all