# GridViewConfig

> Shared default configuration for GridView widgets rendered inside the debug panel UI.

[API reference](/docs/api/index.md) › [Debug](/docs/extensions/debug/reference/index.md) › GridViewConfig

| final class | `yii\debug\GridViewConfig` |
| --- | --- |
| Source | [`src/GridViewConfig.php`](https://github.com/yii2-extensions/debug/blob/main/src/GridViewConfig.php#L18) |

Shared default configuration for GridView widgets rendered inside the debug panel UI.

Centralizes the pager markup, table classes, and row-status helpers so every `GridView::widget(...)` call in the
debug views emits consistent, namespaced, framework-agnostic markup.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`defaults()`](#method-defaults) static | Returns the default GridView options for the debug UI. | `GridViewConfig` |
| [`pageSizeSelectorHtml()`](#method-pageSizeSelectorHtml) static | Returns the inline page-size selector markup rendered inside the GridView footer. | `GridViewConfig` |
| [`paginationFromRequest()`](#method-paginationFromRequest) static | Returns a pagination config keyed off the `per-page` query parameter. | `GridViewConfig` |
| [`rowClassFor()`](#method-rowClassFor) static | Returns the row-options array carrying the `yii-debug-row-<variant>` CSS class for the given status level. | `GridViewConfig` |
| [`sortParams()`](#method-sortParams) static | Returns the current request query parameters without the `page` cursor. | `GridViewConfig` |

## Method details

### defaults() <span id="method-defaults"></span>

```php
public static function defaults(): array{dataColumnClass: class-string<yii\debug\widgets\DebugDataColumn>, tableOptions: array{class: string}, options: array{class: string}, layout: string, pager: array{options: array{class: string}, linkContainerOptions: array{class: string}, linkOptions: array{class: string}, disabledListItemSubTagOptions: array{tag: string, class: string}, activePageCssClass: string, disabledPageCssClass: string}}
```

Returns the default GridView options for the debug UI.

Carries the namespaced `yii-debug-*` CSS classes (so the debug styles never clash with the host application's
grid styles), the custom layout that confines the table to a `.yii-debug-table-wrap` scroll container and
wraps the summary and pager into a single footer, and the pager's active/disabled CSS modifiers used by the
debug stylesheet.

The summary carries no options because [`GridView::renderSummary()`](/docs/extensions/debug/reference/widgets/gridview/index.md#method-renderSummary) renders it through the
shared [`GridCount`](https://github.com/php-forge/debug-core/blob/b70459f033a1d7a1c5edf7951029aad2061986dd/src/View/Grid/GridCount.php) renderer, which owns the wrapper markup.

**Returns**

`array{dataColumnClass: class-string<`[`yii\debug\widgets\DebugDataColumn`](/docs/extensions/debug/reference/widgets/debugdatacolumn/index.md)`>, tableOptions: array{class: string}, options: array{class: string}, layout: string, pager: array{options: array{class: string}, linkContainerOptions: array{class: string}, linkOptions: array{class: string}, disabledListItemSubTagOptions: array{tag: string, class: string}, activePageCssClass: string, disabledPageCssClass: string}}`: GridView config array ready to splat into `GridView::widget([...])`.

### pageSizeSelectorHtml() <span id="method-pageSizeSelectorHtml"></span>

```php
public static function pageSizeSelectorHtml(): string
```

Returns the inline page-size selector markup rendered inside the GridView footer.

The dropdown lets the user switch between `10` / `25` / `50` / `100` / `All` rows per page. JavaScript wired in
`debug.min.js` picks up the change event, rewrites the `per-page` query param, and reloads the panel while
keeping every other filter/sort param intact.

**Returns**

`string`: HTML markup for the page-size selector.

### paginationFromRequest() <span id="method-paginationFromRequest"></span>

```php
public static function paginationFromRequest(positive-int $default = 50): array<string, mixed>|false
```

Returns a pagination config keyed off the `per-page` query parameter.

Reads `per-page` from the parsed request query and translates it into a Yii pagination array. The literal string
`'all'` (case-insensitive) disables pagination entirely. Numeric values are honored within a hard cap of `1000`
rows per page; anything else falls back to `$default`.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$default` | `positive-int` | Page size used when no `per-page` param is supplied or the value is invalid. |

**Returns**

`array<string, mixed>|false`: `false` when `'all'` was requested, otherwise a pagination config carrying `pageSize`, `pageSizeParam`, and `pageSizeLimit`.

### rowClassFor() <span id="method-rowClassFor"></span>

```php
public static function rowClassFor(string|null $level): array<string, mixed>
```

Returns the row-options array carrying the `yii-debug-row-<variant>` CSS class for the given status level.

Accepts `success`, `info`, `warning`, `danger`, and `error` (aliased to `danger`). Unknown or empty levels yield
an empty array, so the caller can splat the result safely.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$level` | `string\|null` | Status keyword, or `null` to skip the class. |

**Returns**

`array<string, mixed>`: Row-options array with the `class` key set, or `[]` for unknown/`null` levels.

### sortParams() <span id="method-sortParams"></span>

```php
public static function sortParams(): array<array-key, mixed>
```

Returns the current request query parameters without the `page` cursor.

Feeding the result to a data provider's `sort` configuration makes every sort link land on page one, matching the
Yii3 debugger, while preserving the active filters, the page size, and the current sort semantics.

**Returns**

`array<array-key, mixed>`: Query parameters with `page` removed.