https://github.com/accessd/yii2-sortable-grid-view-widget
https://github.com/accessd/yii2-sortable-grid-view-widget
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/accessd/yii2-sortable-grid-view-widget
- Owner: accessd
- License: mit
- Created: 2019-11-07T08:47:58.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-07T08:53:41.000Z (over 5 years ago)
- Last Synced: 2025-01-21T00:05:36.060Z (3 months ago)
- Language: PHP
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Sortable GridView Widget for Yii2
========================
Sortable modification of standard Yii2 GridView widget.Installation
------------
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).* Either run
```
php composer.phar require --prefer-dist "himiklab/yii2-sortable-grid-view-widget" "*"
```or add
```json
"himiklab/yii2-sortable-grid-view-widget" : "*"
```to the `require` section of your application's `composer.json` file.
* Add to your database new `unsigned int` attribute, such `sortOrder`.
* Add new behavior in the AR model, for example:
```php
use himiklab\sortablegrid\SortableGridBehavior;public function behaviors()
{
return [
'sort' => [
'class' => SortableGridBehavior::className(),
'sortableAttribute' => 'sortOrder'
],
];
}
```* Add action in the controller, for example:
```php
use himiklab\sortablegrid\SortableGridAction;public function actions()
{
return [
'sort' => [
'class' => SortableGridAction::className(),
'modelName' => Model::className(),
],
];
}
```Usage
-----
* Use SortableGridView as standard GridView with `sortableAction` option.
You can also subscribe to the JS event 'sortableSuccess' generated widget after a successful sorting.