Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/taguz91/yii2-custom-columns
Custom columns for grid view
https://github.com/taguz91/yii2-custom-columns
bootstrap-4 grid widget yii2-extension
Last synced: about 2 months ago
JSON representation
Custom columns for grid view
- Host: GitHub
- URL: https://github.com/taguz91/yii2-custom-columns
- Owner: taguz91
- License: apache-2.0
- Created: 2020-12-13T01:51:35.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-07-04T01:42:49.000Z (over 3 years ago)
- Last Synced: 2024-10-18T00:28:05.794Z (2 months ago)
- Topics: bootstrap-4, grid, widget, yii2-extension
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Custom Columns
==============
This columns is aplicable to grid view, for bootstrap 4[![Latest Stable Version](http://poser.pugx.org/taguz91/yii2-custom-columns/v)](https://packagist.org/packages/taguz91/yii2-custom-columns)
[![Total Downloads](http://poser.pugx.org/taguz91/yii2-custom-columns/downloads)](https://packagist.org/packages/taguz91/yii2-custom-columns)
[![Latest Unstable Version](http://poser.pugx.org/taguz91/yii2-custom-columns/v/unstable)](https://packagist.org/packages/taguz91/yii2-custom-columns)
[![License](http://poser.pugx.org/taguz91/yii2-custom-columns/license)](https://packagist.org/packages/taguz91/yii2-custom-columns)Installation
------------The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
composer require taguz91/yii2-custom-columns
```or add
```
"taguz91/yii2-custom-columns": "~1.0.0"
```to the require section of your `composer.json` file.
Usage
-----Once the extension is installed, simply use it in your code by :
```php
GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'class' => \taguz91\CustomColumns\ArrayValueColumn::class,
'array' => ['1' => 'One', '2' => 'Two'],
'default' => 'default',
'attribute' => 'attribute',
],[
'class' => \taguz91\CustomColumns\CashColumn::class,
'attribute' => 'attribute',
],[
'class' => \taguz91\CustomColumns\ImageColumn::class,
'attribute' => 'attribute',
'urlPrefix' => 'static/images',
],[
'class' => \taguz91\CustomColumns\ModalColumn::class,
'attribute' => 'attribute',
'modalTitle' => 'Detail view',
'render' => Url::to(['detail', 'id' => 1]),
],[
'class' => \taguz91\CustomColumns\MongoDateColumn::class,
'attribute' => 'attribute',
],[
'class' => \taguz91\CustomColumns\PrefixColumn::class,
'attribute' => 'attribute',
],[
'class' => \taguz91\CustomColumns\ShowColumn::class,
'attribute' => 'attribute',
'redirectTo' => 'detail/view'
],[
'class' => \taguz91\CustomColumns\SwitchColumn::class,
'attribute' => 'attribute',
],[
'class' => \taguz91\CustomColumns\SwitchColumn::class,
'attribute' => 'attribute',
'api' => 'api/v1/toggle', // This endpoint add the primarykey
'active' => true, // Condition for activate the toggle
],[
'class' => \taguz91\CustomColumns\UpdatedAtColumn::class,
],
],
]);```
For ```\taguz91\CustomColumns\ModalColumn``` you need to include the modal widget in your layout
```php
= \taguz91\CustomColumns\widgets\ModalAjax::widget() ?>
```For ```\taguz91\CustomColumns\SwitchColumn::class``` you need to include the bootstrap4-toogle assets in your AppAsset
```php
$depends = [
...,
\taguz91\CustomColumns\assets\ToggleAsset::class
];
```