framework/grid/GridView.php
protected function guessColumns()
    {
        $models = $this->dataProvider->getModels();
        $model = reset($models);
        if (is_array($model) || is_object($model)) {
            foreach ($model as $name => $value) {
                if ($value === null || is_scalar($value) || is_callable([$value, '__toString'])) {
                    $this->columns[] = (string) $name;
                }
            }
        }
    }
protected function guessColumns()
    {
        $models = $this->dataProvider->getModels();
        $model = reset($models);
        if (is_array($model) || is_object($model)) {
            foreach ($model as $name => $value) {
                if ($value === null || is_scalar($value) || is_callable([$value, '__toString'])) {
                    $this->columns[] = (string) $name;
                }
            }
        }
    }
protected function guessColumns ( ) { $ models = $ this -> dataProvider -> getModels ( ) ; $ model = reset ( $ models ) ; if ( is_array ( $ model ) || is_object ( $ model ) ) { foreach ( $ model as $ name => $ value ) { if ( $ value === null || is_scalar ( $ value ) || is_callable ( [ $ value , '__toString' ] ) ) { $ this -> columns [ ] = ( string ) $ name ; } } } }
This function tries to guess the columns to show from the given data
if [[columns]] are not explicitly specified.
This function tries to guess the columns to show from the given data if [[ columns ]] are not explicitly specified .