Adds an ordering on the supplied column component.

@param string $componentId
@param string $direction

@return static
199187
public function orderBy(string $componentId, string $direction)
    {
        list($column, $component) = $this->structure->getColumnAndComponent($componentId);

        $this->orderings[] = new ColumnOrdering($column, $component, $direction);

        return $this;
    }
605048
public function setOrderBy($field, $direction = null)
    {
        if (empty($field))
            return $this;

        if (count($order = explode(' ', $field)) == 2) {
            $field = $order[0];
            $direction = $order[1];
        }
        $this->orderBy[$field] = empty($direction) ? 'ASC' : $direction;
        return $this;
    }
716832
public function scopeSort(Builder $query, $column, $direction)
    {
        if (!in_array($column, $this->sortable)) {
            return $query;
        }

        return $query->orderBy($column, $direction);
    }
489214
public function orderBy(array $columns_and_direction) {
		// for each given parameter
		foreach($columns_and_direction as $column => $direction) {
			// if the direction is not valid force ASC
			$direction == 'ASC' || $direction == 'DESC' ?: $direction = 'ASC';
			// secure the column name
			list($column) = Query\Convert::columnToPlaceholder($this->Quote ,$column);
			// push it
			$this->Order[] = "{$column} $direction";
		}
		// return self to the next method
		return $this;
	}
22801
public static function fromOptionsWithDirection(Direction $direction, OptionsInterface $options = null)
    {
        if (null === $options) {
            $options = (new static($direction))->withExceptionOnSkip(false);
        } else {
            $options = $options->withDirection($direction);
        }
        return $options;
    }
421615
public function sortByDefault(string $direction = 'asc'): TableListColumn
    {
        // we check if the method has already been called
        if ($this->getAttribute('tableList')->sortBy || $this->getAttribute('tableList')->sortDir) {
            $errorMessage = 'The « sortByDefault() » method has already been called. '
                            . 'You only can sort a column by default once.';
            throw new ErrorException($errorMessage);
        }
        // we set the sort attribute
        $this->getAttribute('tableList')->sortBy = $this->getAttribute('attribute');
        // we set the sort direction
        $acceptedDirections = ['asc', 'desc'];
        $errorMessage = 'Invalid « $direction » argument for « sortByAttribute() » method. Has to be « asc » or '
                        . '« desc ». « ' . $direction . ' » given.';
        if (! in_array($direction, $acceptedDirections)) {
            throw new InvalidArgumentException($errorMessage);
        }
        $this->getAttribute('tableList')->setAttribute('sortDir', $direction);

        return $this;
    }
358857
function orderBy( $column, $direction = "ASC" ) {

        $clone = clone $this;

        if ($direction===true) {
            $clone->orderBy[] = $column;
        }else{
            $clone->orderBy[] = $this->db->quoteIdentifier( $column ) . " " . $direction;
        }

        return $clone;

    }
178805
public function toComponent(string $componentId)
    {
        if ($this->hidden) {
            throw InvalidOperationException::format('Invalid call to %s: cannot hide an existing column', __METHOD__);
        }

        call_user_func($this->componentIdCallback, $componentId);
    }
236258
public function offsetGet($componentId)
    {
        list($columnName, $componentName) = explode('.', $componentId) + [1 => null];

        return $this->getCellComponentData($columnName, $componentName);
    }
445213
public function orderBy($column, $direction = 'asc')
    {
        $this->{$this->unions ? 'unionOrders' : 'orders'}[] = [
            'column' => $column,
            'direction' => strtolower($direction) == 'asc' ? 'asc' : 'desc',
        ];

        return $this;
    }
506428
public function orderBy(
        string $cypher,
        string $direction = 'ASC'
    ): self {
        $direction = \strtolower($direction);

        $query = new self;
        $query->clauses = $this->clauses->add(
            Clause\OrderByClause::$direction($cypher)
        );

        return $query;
    }
1110059
public function orderBy($index, $direction = 'desc')
    {
        if ($direction != 'desc') {
            $direction = 'asc';
        }

        if (is_array($index)) {
            $this->attributes['order'][] = $index;
        } else {
            $this->attributes['order'][] = [$index, $direction];
        }

        return $this;
    }
75621
public function orderBy($field, $direction = 1)
    {
        if (is_string($direction)) {
            $direction = $direction === 'asc' ? 1 : -1;
        }

        $this->orderBy[$field] = $direction;

        return $this;
    }
74648
public function withDirection(Direction $direction)
    {
        return new static($direction, $this->forced, $this->dryRun, $this->exceptionOnSkip, $this->custom);
    }
1141726
public function sort($key, $direction=CanSort::ASC)
    {
        $this->bootCanSortMethodsOnce();
        $this->sorting[$key] = $direction;
        return $this;
    }
271448
public function addOrder($field, $direction = SORT_ASC) {
		$this->query[self::ORDER][ $field ] = $direction;
		return $this;
	}
1247056
public function getOrdered($direction = 'asc')
    {
        $components = $this->enabled();

        uasort($components, function(Component $a, Component $b) use ($direction) {
            if ($a->order == $b->order) {
                return 0;
            }

            if ($direction == 'desc') {
                return $a->order < $b->order ? 1 : -1;
            }

            return $a->order > $b->order ? 1 : -1;
        });

        return $components;
    }