public function setDefaultSort(array $sort)
    {
        static $replace = ['asc' => Column::ORDER_ASC, 'desc' => Column::ORDER_DESC];

        foreach ($sort as $column => $dir) {
            $dir = strtr(strtolower($dir), $replace);
            if (!in_array($dir, $replace)) {
                throw new Exception("Dir '$dir' for column '$column' is not allowed.");
            }

            $this->defaultSort[$column] = $dir;
        }

        return $this;
    }
public function setDefaultSort(array $sort)
    {
        static $replace = ['asc' => Column::ORDER_ASC, 'desc' => Column::ORDER_DESC];

        foreach ($sort as $column => $dir) {
            $dir = strtr(strtolower($dir), $replace);
            if (!in_array($dir, $replace)) {
                throw new Exception("Dir '$dir' for column '$column' is not allowed.");
            }

            $this->defaultSort[$column] = $dir;
        }

        return $this;
    }
public function setDefaultSort ( array $ sort ) { static $ replace = [ 'asc' => Column :: ORDER_ASC , 'desc' => Column :: ORDER_DESC ] ; foreach ( $ sort as $ column => $ dir ) { $ dir = strtr ( strtolower ( $ dir ) , $ replace ) ; if ( ! in_array ( $ dir , $ replace ) ) { throw new Exception ( "Dir '$dir' for column '$column' is not allowed." ) ; } $ this -> defaultSort [ $ column ] = $ dir ; } return $ this ; }
Sets default sorting.
@param array $sort
@return Grid
@throws Exception
Sets default sorting .