Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** @var Query $query */
- $query = Storage::find();
- $dataProvider = new ActiveDataProvider([
- 'query' => $query,
- 'pagination' => [
- 'pageSize' => 50,
- ],
- 'sort' => [
- 'defaultOrder' => [
- 'abbreviation' => SORT_ASC
- ],
- 'attributes' => [
- 'id',
- 'status',
- 'name' => [
- 'asc' => [new Expression('LENGTH(name) ASC, name ASC')],
- 'desc' => [new Expression('LENGTH(name) DESC, name DESC')],
- 'default' => SORT_ASC,
- ],
- 'abbreviation' => [
- 'asc' => [new Expression('LENGTH(abbreviation) ASC, abbreviation ASC')],
- 'desc' => [new Expression('LENGTH(abbreviation) DESC, abbreviation DESC')],
- 'default' => SORT_ASC,
- ],
- ]
- ]
- ]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement