Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Enh #1369: Added CCheckBoxColumn::disabled that accepts PHP expressio…

…n or anonymous function determining if checkbox for the row should be disabled
  • Loading branch information...
commit 2e9fd7e0e900beaf939e9fde8a10ff533bbab1a5 2 parents 10ea135 + ed04f69
@samdark samdark authored
Showing with 12 additions and 1 deletion.
  1. +1 −0  CHANGELOG
  2. +11 −1 framework/zii/widgets/grid/CCheckBoxColumn.php
@@ -33,6 +33,7 @@ Version 1.1.13 work in progress
- Enh #1286: CUrlValidator now supports IDN (Internationalized Domain Names), added CUrlValidator::$validateIDN property (resurtm)
- Enh #1289: Added support for column comments for MSSQL (CDbColumnSchema::$comment property) (resurtm)
- Enh #1299: Added CSRF token validation for PUT and DELETE (miraage, samdark)
+- Enh #1369: Added CCheckBoxColumn::disabled that accepts PHP expression or anonymous function determining if checkbox for the row should be disabled (sucotronic)
- Enh: Fixed the check for ajaxUpdate false value in jquery.yiilistview.js as that never happens (mdomba)
- Enh: Requirements checker: added check for Oracle database (pdo_oci extension) and MSSQL (pdo_dblib, pdo_sqlsrv and pdo_mssql extensions) (resurtm)
- Enh: Added CChainedLogFilter class to allow adding multiple filters to a logroute (cebe)
12 framework/zii/widgets/grid/CCheckBoxColumn.php
@@ -53,6 +53,14 @@ class CCheckBoxColumn extends CGridColumn
public $checked;
+ * @var string a PHP expression that will be evaluated for every data cell and whose result will
+ * determine if checkbox for each data cell is disabled. In this expression, the variable
+ * <code>$row</code> the row number (zero-based); <code>$data</code> the data model for the row;
+ * and <code>$this</code> the column object.
+ * @since 1.1.13
+ */
+ public $disabled;
+ /**
* @var array the HTML options for the data cell tags.
public $htmlOptions=array('class'=>'checkbox-column');
@@ -136,7 +144,7 @@ public function init()
$(document).on('click','#{$this->id}_all',function() {
var checked=this.checked;
- $("input[name='$name']").each(function() {this.checked=checked;});
+ $("input[name='$name']:enabled").each(function() {this.checked=checked;});
@@ -203,6 +211,8 @@ protected function renderDataCellContent($row,$data)
$checked = false;
+ if($this->disabled!==null)
+ $this->checkBoxHtmlOptions['disabled']=$this->evaluateExpression($this->disabled,array('data'=>$data,'row'=>$row));
@mdomba Collaborator
mdomba added a note

Two questions on this:

  • why adding this value to checkBoxHtmlOptions and then just assigning this to $options? It would be more practical to assign this directly to $options['disabled']

  • what happens if someone already set checkBoxHtmlOptions['disabled'] to any value? That value gets overwritten with the result of evaluateExpression but that is not mentioned in the doc.

@samdark Owner
samdark added a note

Thanks. Fixed 6d21f82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

0 comments on commit 2e9fd7e

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