Esempio n. 1
0
 /**
  * Add column
  * @param string $name
  * @param string $label
  * @param callback $renderer
  * @return Column
  */
 public function addColumn($name, $label, $renderer = null)
 {
     $column = new Column($this["columns"], $name);
     $column->setLabel($label);
     if ($renderer) {
         $column->setCellRenderer($renderer);
     }
     return $column;
 }
Esempio n. 2
0
 /**
  * Add column
  * @param string name
  * @param string label
  * @param array options
  * @return Column
  */
 public function addColumn($name, $label = null, array $options = array())
 {
     $column = new Column($this["columns"], $name);
     $column->setLabel($label);
     $this->setOptions($column, $options);
     return $column;
 }
Esempio n. 3
0
 /**
  * Gets cell class
  * @param $iterator
  * @param $row
  * @return string
  */
 public function getCellClass($iterator, $row)
 {
     return str_replace('gridito-cell', 'gridito-checkboxcell', parent::getCellClass($iterator, $row));
 }
Esempio n. 4
0
 /**
  * Default cell renderer
  * @param mixed $record
  * @param Column $column
  */
 public static function defaultCellRenderer($record, $column)
 {
     $name = $column->getName();
     $value = $record->{$name};
     // true/false
     if (is_bool($value)) {
         $icon = $value ? "check" : "closethick";
         echo '<span class="ui-icon ui-icon-' . $icon . '"></span>';
         // date
     } elseif ($value instanceof \DateTime) {
         echo $value->format($column->dateTimeFormat);
         // other
     } else {
         echo $value;
     }
 }
Esempio n. 5
0
 /**
  * Default cell renderer
  * @param mixed $record
  * @param Column $column
  * @return mixed
  */
 public function defaultCellRenderer($record, $column)
 {
     $name = $column->getName();
     $value = $record->{$name};
     // boolean
     if (in_array($this->type, array('bool', 'boolean')) || is_bool($value)) {
         return self::renderBoolean($value);
         // date
     } elseif ($value instanceof \DateTime) {
         return self::renderDateTime($value, $this->dateTimeFormat);
         // email
     } elseif ($this->type == 'email') {
         return self::renderEmail($value, $this->maxlen);
         // other
     } else {
         if (!is_null($this->format)) {
             $value = Grid::formatRecordString($record, $this->format);
         }
         return self::renderText($value, $this->maxlen);
     }
 }
Esempio n. 6
0
 /**
  * Add column
  * @param string name
  * @param string label
  * @param array options
  * @return Column
  */
 public function addColumn($name, $label = null, array $options = array())
 {
     $componentName = \Nette\Utils\Strings::webalize($name);
     $componentName = strtr($componentName, '-', '_');
     $column = new Column($this['columns'], $componentName);
     $column->setColumnName($name);
     $column->setLabel($label);
     $this->setOptions($column, $options);
     return $column;
 }