TCheckBoxColumn represents a checkbox column that is bound to a field in a data source. The checked state of the checkboxes are determiend by the bound data at {@link setDataField DataField}. If {@link setReadOnly ReadOnly} is false, TCheckBoxColumn will display an enabled checkbox provided the cells are in edit mode. Otherwise, the checkboxes will be disabled to prevent from editting. The checkbox control in the TCheckBoxColumn can be accessed by one of the following two methods: $datagridItem->CheckBoxColumnID->CheckBox $datagridItem->CheckBoxColumnID->Controls[0] The second method is possible because the checkbox control created within the datagrid cell is the first child.
С версии: 3.0
Автор: Qiang Xue (qiang.xue@gmail.com)
Наследование: extends TDataGridColumn
Пример #1
0
 /**
  * Initializes the specified cell to its initial values.
  * This method overrides the parent implementation.
  * It creates a checkbox inside the cell.
  * If the column is read-only or if the item is not in edit mode,
  * the checkbox will be set disabled.
  * @param TTableCell the cell to be initialized.
  * @param integer the index to the Columns property that the cell resides in.
  * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem)
  */
 public function initializeCell($cell, $columnIndex, $itemType)
 {
     if ($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) {
         $checkBox = new TActiveCheckBox();
         if ($this->getReadOnly() || $itemType !== TListItemType::EditItem) {
             $checkBox->setEnabled(false);
         }
         $cell->setHorizontalAlign('Center');
         $cell->getControls()->add($checkBox);
         $cell->registerObject('CheckBox', $checkBox);
         if ($this->getDataField() !== '') {
             $checkBox->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn'));
         }
     } else {
         parent::initializeCell($cell, $columnIndex, $itemType);
     }
 }