Пример #1
0
 public function testGetFilter()
 {
     $column = new Column($this->table, 'test');
     $filter = $column->getFilter();
     $this->assertTag(['tag' => 'div', 'attributes' => ['class' => 'grid-view-filter-container'], 'child' => ['tag' => 'input', 'attributes' => ['name' => 'test', 'type' => 'text', 'class' => 'grid-view-filter input-small form-control']]], $filter);
     $column = new Column($this->table, ['name' => 'test', 'filter' => [0 => 'no', 1 => 'yes']]);
     $filter = $column->getFilter();
     $this->assertTag(['tag' => 'select', 'attributes' => ['name' => 'test', 'class' => 'form-control'], 'descendant' => ['tag' => 'option', 'attributes' => ['value' => '0']]], $filter);
 }
Пример #2
0
 /**
  * @param $columnName
  * @return $this
  */
 public function addColumn($columnName)
 {
     if (is_scalar($columnName)) {
         $column = new Column($this, $columnName);
     }
     if (is_array($columnName)) {
         $column = new Column($this, $columnName);
     }
     $this->columns[] = $column;
     $this->addJavascript($column->getJavascript(), $column->getName());
     return $this;
 }