Example #1
0
 /**
  * This method will be called when the component (or component's parent)
  * becomes attached to a monitored object. Do not call this method yourself.
  * @param  Nette\IComponent
  * @return void
  */
 protected function attached($dataGrid)
 {
     if ($dataGrid instanceof DataGrid\DataGrid) {
         $dataSource = clone $dataGrid->dataSource;
         $this->min = $this->max = 0;
         $first = $dataSource->sort($this->getName(), IDataSource::ASCENDING)->reduce(1)->fetch();
         if (count($first) > 0) {
             $this->min = (int) $first[0][$this->getName()];
         }
         $last = $dataSource->sort($this->getName(), IDataSource::DESCENDING)->reduce(1)->fetch();
         if (count($last) > 0) {
             $this->max = (int) $first[0][$this->getName()];
         }
     }
     parent::attached($dataGrid);
 }
Example #2
0
 /**
  * Checkbox column constructor.
  * @param  string  column's textual caption
  * @return void
  */
 public function __construct($caption = NULL)
 {
     parent::__construct($caption, 0);
     $this->getCellPrototype()->style('text-align: center');
 }