Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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,
],
],
```