PHPackages                             morning-bird/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. morning-bird/yii2-sortable-gridview

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

morning-bird/yii2-sortable-gridview
===================================

Sortable GridView for Yii2

v1.0.3(6y ago)0436MITPHP

Since Jun 21Pushed 6y agoCompare

[ Source](https://github.com/morning-bird/yii2-sortable-gridview)[ Packagist](https://packagist.org/packages/morning-bird/yii2-sortable-gridview)[ RSS](/packages/morning-bird-yii2-sortable-gridview/feed)WikiDiscussions master Synced today

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

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

[](#yii2-sortable-gridview)

[![Latest Stable Version](https://camo.githubusercontent.com/b17d6c319f8befbcc65050865b62699bebd46bc00d4f06536e7743b25fcc31c4/68747470733a2f2f706f7365722e707567782e6f72672f6d6f726e696e672d626972642f796969322d736f727461626c652d67726964766965772f762f737461626c65)](https://packagist.org/packages/morning-bird/yii2-sortable-gridview)[![Total Downloads](https://camo.githubusercontent.com/f2327a56cbd7500762c85f7a6957caf47346e18fc1f3b201b1164791706b9299/68747470733a2f2f706f7365722e707567782e6f72672f6d6f726e696e672d626972642f796969322d736f727461626c652d67726964766965772f646f776e6c6f616473)](https://packagist.org/packages/morning-bird/yii2-sortable-gridview)[![GitHub stars](https://camo.githubusercontent.com/93a00c0a358c38d9eae6f122e87f76dd3eb449687fbd32aa3fef982f0255aa0c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6d6f726e696e672d626972642f796969322d736f727461626c652d67726964766965772e737667)](https://github.com/morning-bird/yii2-sortable-gridview/stargazers)[![GitHub issues](https://camo.githubusercontent.com/acc6f06ab880d20511082c7e3b53298cf11ebc7d6c47794a82b4aac7e75912eb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6d6f726e696e672d626972642f796969322d736f727461626c652d67726964766965772e737667)](https://github.com/morning-bird/yii2-sortable-gridview/issues)

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 morning-bird/yii2-sortable-gridview "*"

```

or

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

```

or add

```
"morning-bird/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 richardfan\sortable\SortableAction;

public function actions(){
    return [
        'sortItem' => [
            'class' => SortableAction::className(),
            'activeRecordClassName' => YourActiveRecordClass::className(),
            'orderColumn' => 'name_of_field_storing_ordering',
        ],
        // 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;
