Author: Petr Bugyík
Inheritance: extends Grido\Components\Component
Ejemplo n.º 1
0
 /**
  * @param \Grido\Components\Columns\Column $column
  * @param Callable $recordCallback
  * @return \Grido\Components\Columns\Column
  */
 public function setupAsMultirecord(\Grido\Components\Columns\Column $column, $recordCallback)
 {
     $column->getCellPrototype()->class[] = 'multirecord';
     $column->setCustomRender(function ($row) use($recordCallback) {
         $return = Html::el('ul', ['class' => 'select2-choices']);
         foreach ($recordCallback($row) as $item) {
             $li = Html::el('li', ['class' => 'select2-search-choice']);
             $li->create('div', $item);
             $return->add($li);
         }
         return $return;
     });
     return $column;
 }
Ejemplo n.º 2
0
 /**
  * Returns cell prototype (<td> html tag).
  * @param mixed $row
  * @return \Nette\Utils\Html
  */
 public function getCellPrototype($row = NULL)
 {
     $td = parent::getCellPrototype($row);
     if ($this->isEditable() && $row !== NULL) {
         if (!in_array('editable', $td->class)) {
             $td->class[] = 'editable';
         }
         $td->data['grido-editable-value'] = $this->editableValueCallback === NULL ? $this->getValue($row) : call_user_func_array($this->editableValueCallback, [$row, $this]);
     }
     return $td;
 }
Ejemplo n.º 3
0
 /**
  * Returns cell prototype (<td> html tag).
  * @param mixed $row
  * @return \Nette\Utils\Html
  */
 public function getCellPrototype($row = NULL)
 {
     $td = parent::getCellPrototype($row);
     if ($this->isEditable() && $row !== NULL) {
         $td->data['grido-editable-value'] = $this->editableValueCallback === NULL ? parent::getValue($row) : callback($this->editableValueCallback)->invokeArgs(array($row, $this));
     }
     return $td;
 }