Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 24 days 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 (25 days ago)
- Default Branch: main
- Last Pushed: 2024-12-09T12:01:37.000Z (25 days ago)
- Last Synced: 2024-12-09T12:24:10.080Z (25 days ago)
- Topics: bootstrap4, bootstrap5, filter, gridview, yii2
- Language: PHP
- Homepage:
- Size: 28.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:
![Fix for Yii2 GridView DataColumn for filter validational errors to be properly shown with bootstrap 4 and 5](https://raw.githubusercontent.com/mgrechanik/gridviewfilterfix/refs/heads/main/docs/yii2-gridview-filter-fix-for-bootstrap4-and-5.png "Fix for Yii2 GridView DataColumn for filter validational errors to be properly shown with bootstrap 4 and 5")
## 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 GridView and Bootstrap 4 / 5
#### Paginator does not look good
Solution:
```php
'container' => [
'definitions' => [
\yii\widgets\LinkPager::class => \yii\bootstrap5\LinkPager::class,
],
],
```