src/Table.php
public function setModel(\atk4\data\Model $m, $columns = null)
    {
        parent::setModel($m);

        if ($columns === null) {
            $columns = [];
            foreach ($m->elements as $name => $element) {
                if (!$element instanceof \atk4\data\Field) {
                    continue;
                }

                if ($element->isVisible()) {
                    $columns[] = $name;
                }
            }
        } elseif ($columns === false) {
            return $this->model;
        }

        foreach ($columns as $column) {
            $this->addColumn($column);
        }

        return $this->model;
    }
public function setModel(\atk4\data\Model $m, $columns = null)
    {
        parent::setModel($m);

        if ($columns === null) {
            $columns = [];
            foreach ($m->elements as $name => $element) {
                if (!$element instanceof \atk4\data\Field) {
                    continue;
                }

                if ($element->isVisible()) {
                    $columns[] = $name;
                }
            }
        } elseif ($columns === false) {
            return $this->model;
        }

        foreach ($columns as $column) {
            $this->addColumn($column);
        }

        return $this->model;
    }
public function setModel ( \ atk4 \ data \ Model $ m , $ columns = null ) { parent :: setModel ( $ m ) ; if ( $ columns === null ) { $ columns = [ ] ; foreach ( $ m -> elements as $ name => $ element ) { if ( ! $ element instanceof \ atk4 \ data \ Field ) { continue ; } if ( $ element -> isVisible ( ) ) { $ columns [ ] = $ name ; } } } elseif ( $ columns === false ) { return $ this -> model ; } foreach ( $ columns as $ column ) { $ this -> addColumn ( $ column ) ; } return $ this -> model ; }
Sets data Model of Table.

If $columns is not defined, then automatically will add columns for all
visible model fields. If $columns is set to false, then will not add
columns at all.

@param \atk4\data\Model $m       Data model
@param array|bool       $columns

@return \atk4\data\Model
Sets data Model of Table .