PHPackages                             kotchuprik/yii2-sortable-widgets - 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. kotchuprik/yii2-sortable-widgets

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

kotchuprik/yii2-sortable-widgets
================================

Implementation Rubaxa/Sortable for Yii2. Sortable grid view inside.

v2.2.0(3y ago)61132.2k↓10.2%23[1 PRs](https://github.com/kotchuprik/yii2-sortable-widgets/pulls)6MITPHP

Since Oct 14Pushed 3y ago10 watchersCompare

[ Source](https://github.com/kotchuprik/yii2-sortable-widgets)[ Packagist](https://packagist.org/packages/kotchuprik/yii2-sortable-widgets)[ Docs](http://github.com/kotchuprik/yii2-sortable-widgets)[ RSS](/packages/kotchuprik-yii2-sortable-widgets/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (13)Used By (6)

Yii2 Sortable widgets
=====================

[](#yii2-sortable-widgets)

[![Join the chat at https://gitter.im/kotchuprik/yii2-sortable-widgets](https://camo.githubusercontent.com/9b4fb563d78d1184c04363a644414f8a764097599e86f5002a4c8021f0886261/68747470733a2f2f6261646765732e6769747465722e696d2f6b6f746368757072696b2f796969322d736f727461626c652d776964676574732e737667)](https://gitter.im/kotchuprik/yii2-sortable-widgets?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Implementation Rubaxa/Sortable for Yii2 widgets.

Supported:

- GridView widget.

[![demo](https://camo.githubusercontent.com/32974438c1f9e42303245a2e565868806ed24b0d2560d6e13bf1f04d8c3a486a/68747470733a2f2f6873746f2e6f72672f66696c65732f3630652f6537612f6365642f36306565376163656437373934613633386430613633363530363233393761642e676966)](https://camo.githubusercontent.com/32974438c1f9e42303245a2e565868806ed24b0d2560d6e13bf1f04d8c3a486a/68747470733a2f2f6873746f2e6f72672f66696c65732f3630652f6537612f6365642f36306565376163656437373934613633386430613633363530363233393761642e676966)

[![Latest Stable Version](https://camo.githubusercontent.com/fdda4f565370b9946a3ca859cd73ce005fe810c497908572c9c0d80e07426021/68747470733a2f2f706f7365722e707567782e6f72672f6b6f746368757072696b2f796969322d736f727461626c652d776964676574732f762f737461626c65)](https://packagist.org/packages/kotchuprik/yii2-sortable-widgets)[![Total Downloads](https://camo.githubusercontent.com/b3ba5ef458c06e9685b4d18c7fe4b423e95f2a4fcda57ba1ff993d5b5fab7cbf/68747470733a2f2f706f7365722e707567782e6f72672f6b6f746368757072696b2f796969322d736f727461626c652d776964676574732f646f776e6c6f616473)](https://packagist.org/packages/kotchuprik/yii2-sortable-widgets)[![Monthly Downloads](https://camo.githubusercontent.com/f0574acb77ed5a5e9a018b4dd6262b534deb35d4e9d7dd603ef5bec818d4ab7a/68747470733a2f2f706f7365722e707567782e6f72672f6b6f746368757072696b2f796969322d736f727461626c652d776964676574732f642f6d6f6e74686c79)](https://packagist.org/packages/kotchuprik/yii2-sortable-widgets)[![Latest Unstable Version](https://camo.githubusercontent.com/b5881e31ef833da68ead997a0025e349d1ed3d59688782b2e96ccaf1a18be4d4/68747470733a2f2f706f7365722e707567782e6f72672f6b6f746368757072696b2f796969322d736f727461626c652d776964676574732f762f756e737461626c65)](https://packagist.org/packages/kotchuprik/yii2-sortable-widgets)[![License](https://camo.githubusercontent.com/c4b6e972f66caf2310af2043126cdec2a558656c529bfe6a76dc992980a75a09/68747470733a2f2f706f7365722e707567782e6f72672f6b6f746368757072696b2f796969322d736f727461626c652d776964676574732f6c6963656e7365)](https://packagist.org/packages/kotchuprik/yii2-sortable-widgets)

Usage
-----

[](#usage)

Create a new migration, change a parent to the migration class from the extension and specify the table name property:

```
class m140811_131705_Models_order extends \kotchuprik\sortable\migrations\Migration
{
    protected $tableName = 'models';
}
```

Add the sortable behavior to your model and specify the query property:

```
public function behaviors()
{
    return [
        'sortable' => [
            'class' => \kotchuprik\sortable\behaviors\Sortable::className(),
            'query' => self::find(),
        ],
    ];
}
```

Add the sorting action to your controller and specify the query property:

```
public function actions()
{
    return [
        'sorting' => [
            'class' => \kotchuprik\sortable\actions\Sorting::className(),
            'query' => \vendor\namespace\Model::find(),
        ],
    ];
}
```

If you're using another primary key (not 'id'), you must specify it in 'pk' parameter:

```
public function actions()
{
    return [
        'sorting' => [
            'class' => \kotchuprik\sortable\actions\Sorting::className(),
            'query' => \vendor\namespace\Model::find(),
            'pk' => 'modelField'
        ],
    ];
}
```

Add the column to your grid view and specify the sorting url like here:

```
echo \yii\grid\GridView::widget([
    'dataProvider' => $model->search(),
    'rowOptions' => function ($model, $key, $index, $grid) {
        return ['data-sortable-id' => $model->id];
    },
    'columns' => [
        [
            'class' => \kotchuprik\sortable\grid\Column::className(),
        ],
        'id',
        'title',
        'order',
    ],
    'options' => [
        'data' => [
            'sortable-widget' => 1,
            'sortable-url' => \yii\helpers\Url::toRoute(['sorting']),
        ]
    ],
]);
```

If cdn is not accessible in your country, you can use Sortable library from local dependencies:

```
...
    'columns' => [
        [
            'class' => \kotchuprik\sortable\grid\Column::className(),
            'useCdn' => false
        ],
        ...
    ],
...
```

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 75.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~257 days

Recently: every ~425 days

Total

12

Last Release

1405d ago

Major Versions

1.0.1 → v2.0.02015-08-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5764b62d1883e2d0b0a733646c2dbc220cd825d62d7f33c8c5d571b62516c3c?d=identicon)[kotchuprik](/maintainers/kotchuprik)

---

Top Contributors

[![chuprik](https://avatars.githubusercontent.com/u/802946?v=4)](https://github.com/chuprik "chuprik (41 commits)")[![nismangulov](https://avatars.githubusercontent.com/u/6184888?v=4)](https://github.com/nismangulov "nismangulov (5 commits)")[![hryvinskyi](https://avatars.githubusercontent.com/u/9294098?v=4)](https://github.com/hryvinskyi "hryvinskyi (2 commits)")[![sluchznak](https://avatars.githubusercontent.com/u/4091442?v=4)](https://github.com/sluchznak "sluchznak (2 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")[![et-nik](https://avatars.githubusercontent.com/u/3670640?v=4)](https://github.com/et-nik "et-nik (1 commits)")[![Fellzo](https://avatars.githubusercontent.com/u/15001713?v=4)](https://github.com/Fellzo "Fellzo (1 commits)")[![bmsrox](https://avatars.githubusercontent.com/u/3869640?v=4)](https://github.com/bmsrox "bmsrox (1 commits)")

---

Tags

drag-and-dropsortablewidgetyii2yii2-widgetsgridsortableyii2sortingjQueryUIgridviewdndrubaxa

### Embed Badge

![Health badge](/badges/kotchuprik-yii2-sortable-widgets/health.svg)

```
[![Health](https://phpackages.com/badges/kotchuprik-yii2-sortable-widgets/health.svg)](https://phpackages.com/packages/kotchuprik-yii2-sortable-widgets)
```

###  Alternatives

[himiklab/yii2-sortable-grid-view-widget

Sortable modification of standard Yii2 GridView widget

80351.1k7](/packages/himiklab-yii2-sortable-grid-view-widget)[paulzi/yii2-sortable

Sortable Behavior for Yii2

15310.5k4](/packages/paulzi-yii2-sortable)[yiister/yii2-advanced-grid

Advanced GridView extension for Yii framework 2

4712.5k](/packages/yiister-yii2-advanced-grid)[sjaakp/yii2-alphapager

Page data on initial character in Yii2.

184.4k](/packages/sjaakp-yii2-alphapager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
