PHPackages                             taimurkhan911/yii2-sortable-gridview - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. taimurkhan911/yii2-sortable-gridview

ActiveYii2-extension[Framework](/categories/framework)

taimurkhan911/yii2-sortable-gridview
====================================

Sortable GridView for Yii2

v1.0.1(2y ago)149MITPHP

Since Oct 9Pushed 2y ago1 watchersCompare

[ Source](https://github.com/taimurkhan911/yii2-sortable-gridview)[ Packagist](https://packagist.org/packages/taimurkhan911/yii2-sortable-gridview)[ RSS](/packages/taimurkhan911-yii2-sortable-gridview/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (4)Used By (0)

yii2-sortable-gridview
======================

[](#yii2-sortable-gridview)

This is an extension of Yii2 GridView.

This extension render a sortable GridView which you can drag and drop the record items from the list, and store the order in ActiveRecord.

Getting Started
---------------

[](#getting-started)

### Installing

[](#installing)

Install with Composer:

```
composer require taimurkhan911/yii2-sortable-gridview "*"

```

or

```
php composer.phar require taimurkhan911/yii2-sortable-gridview "*"

```

or add

```
"taimurkhan911/yii2-sortable-gridview":"*"

```

to the require section of your composer.json file.

### Setting up SortableAction

[](#setting-up-sortableaction)

In your controller, add the SortableAction into action():

```
use taimurkhan911\sortable\SortableAction;

public function actions(){
    return [
        'sortItem' => [
            'class' => SortableAction::className(),
            'activeRecordClassName' => YourActiveRecordClass::className(),
            'orderColumn' => 'name_of_field_storing_ordering',
            'startPosition' => 1, // optional, default is 0
        ],
        // your other actions
    ];
}
```

### Setting up SortableGridView

[](#setting-up-sortablegridview)

In the view file, use SortableGridView as using the Yii default GridView

```
use richardfan\sortable\SortableGridView;
