https://github.com/mgrechanik/gridviewfilterfix
Fixing yii2 gridview filter functionality to work with Bootstrap 4 and Bootstrap 5
https://github.com/mgrechanik/gridviewfilterfix
bootstrap4 bootstrap5 filter gridview yii2
Last synced: 3 months ago
JSON representation
Fixing yii2 gridview filter functionality to work with Bootstrap 4 and Bootstrap 5
- Host: GitHub
- URL: https://github.com/mgrechanik/gridviewfilterfix
- Owner: mgrechanik
- License: other
- Created: 2024-12-09T11:12:53.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-12-11T05:13:52.000Z (7 months ago)
- Last Synced: 2025-04-12T07:17:59.438Z (3 months ago)
- Topics: bootstrap4, bootstrap5, filter, gridview, yii2
- Language: PHP
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Fix for Yii2 GridView filter functionality to work properly with Bootstrap 4 and Bootstrap 5
## What is it about?
When you are using Yii2 default GridView you might meet a problem that validation errors for filter model are not displayed properly, like this:

## Installing
#### Installing through composer::
The preferred way to install this library is through composer.
Either run
```
composer require --prefer-dist mgrechanik/gridviewfilterfix
```or add
```
"mgrechanik/gridviewfilterfix" : "~1.0.0"
```
to the require section of your `composer.json`.## How to use
Add the following lines of code to your main configuration file:
1) For Bootstrap 4
```php
'container' => [
'definitions' => [
\yii\grid\GridView::class => [
'dataColumnClass' => \mgrechanik\gridviewfilterfix\Bs4DataColumn::class
]
]
],
```2) For Bootstrap 5
```php
'container' => [
'definitions' => [
\yii\grid\GridView::class => [
'dataColumnClass' => \mgrechanik\gridviewfilterfix\Bs5DataColumn::class
]
]
],
```## Similar problems with Forms or GridView and Bootstrap 4 / 5
#### Paginator does not look good
Solution:
```php
'container' => [
'definitions' => [
\yii\widgets\LinkPager::class => \yii\bootstrap5\LinkPager::class,
],
],
```#### Error block under field is now shown, after failed validation, since this block is not at the same level with input.is-invalid
There is a [library](https://github.com/mgrechanik/yii2-activefield-additional-error "Solve problem when invalid-feedback block is not visible for bootstrap in Yii2") to solve this problem