OpenSkill\Datatable\Views\DatatableView::columns PHP Метод

columns() публичный Метод

Will set the columns for the view
public columns ( string $columnName, string $label = null )
$columnName string The name of the column
$label string The label for this column
    public function columns($columnName, $label = null)
    {
        if (!is_string($columnName)) {
            throw new \InvalidArgumentException('$columnName must be set');
        }
        if ($this->resetColumns) {
            $this->columns = [];
            $this->resetColumns = false;
        }
        if (is_null($label)) {
            $label = $columnName;
        }
        $this->columns[$columnName] = $label;
        return $this;
    }

Usage Example

Пример #1
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testInvalidColumns()
 {
     $this->dtv->columns(123);
 }