alisherdavronov / yii2-grid-sort-column-enh
Bootstrap Grid Sort Column Enhanced Widget for Yii2 based on greshnik/yii2-grid-sort-column
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: ~2.0.0
- yiisoft/yii2-bootstrap: ~2.0.3
This package is not auto-updated.
Last update: 2025-01-08 18:58:35 UTC
README
based on greshnik/yii2-grid-sort-column
Installation
The preferred way to install this extension is through composer.
Either run
composer require alisherdavronov/yii2-grid-sort-column-enh "*"
or add
"alisherdavronov/yii2-grid-sort-column-enh" : "*"
to the require section of your application's composer.json
file.
Usage
Example
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'name',
'class',
['class' => 'yii\grid\ActionColumn'],
['class' => 'app\gridSortColumnEnh\SortColumn'],
],
]); ?>
Example add sort action in controller
public function actions()
{
return [
'swap' => [
'class' => 'app\gridSortColumnEnh\Swap',
'model' => new Mark,
'attribute' => 'sortAttribute',
]
];
}
Example add behavior in model
public function behaviors()
{
return [
'sort' => [
'class' => 'app\gridSortColumnEnh\SortBehavior',
'attribute' => 'sort',
'parentAttribute' => 'parentId', // optional
]
];
}
License
The BSD License (BSD). Please see License File for more information.