Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

New feature: allow disabled checkboxes

  • Loading branch information...
commit 51f75577664c23003b0f486d995e5d9f0fee1524 1 parent 604441c
Felix felix-sigac authored

Showing 1 changed file with 10 additions and 1 deletion. Show diff stats Hide diff stats

  1. +10 1 framework/zii/widgets/grid/CCheckBoxColumn.php
11 framework/zii/widgets/grid/CCheckBoxColumn.php
@@ -53,6 +53,13 @@ class CCheckBoxColumn extends CGridColumn
53 53 */
54 54 public $checked;
55 55 /**
  56 + * @var string a PHP expression that will be evaluated for every data cell and whose result will
  57 + * determine if checkbox for each data cell is disabled. In this expression, the variable
  58 + * <code>$row</code> the row number (zero-based); <code>$data</code> the data model for the row;
  59 + * and <code>$this</code> the column object.
  60 + */
  61 + public $disabled=null;
  62 + /**
56 63 * @var array the HTML options for the data cell tags.
57 64 */
58 65 public $htmlOptions=array('class'=>'checkbox-column');
@@ -136,7 +143,7 @@ public function init()
136 143 $cball=<<<CBALL
137 144 $(document).on('click','#{$this->id}_all',function() {
138 145 var checked=this.checked;
139   - $("input[name='$name']").each(function() {this.checked=checked;});
  146 + $("input[name='$name']:enabled").each(function() {this.checked=checked;});
140 147 });
141 148
142 149 CBALL;
@@ -203,6 +210,8 @@ protected function renderDataCellContent($row,$data)
203 210 $checked = false;
204 211 if($this->checked!==null)
205 212 $checked=$this->evaluateExpression($this->checked,array('data'=>$data,'row'=>$row));
  213 + if($this->disabled!==null)
  214 + $this->checkBoxHtmlOptions['disabled']=$this->evaluateExpression($this->disabled,array('data'=>$data,'row'=>$row));
206 215
207 216 $options=$this->checkBoxHtmlOptions;
208 217 $name=$options['name'];

0 comments on commit 51f7557

Please sign in to comment.
Something went wrong with that request. Please try again.