PHPackages                             sharkom/yii2-nested-sortable-widget - 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. sharkom/yii2-nested-sortable-widget

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

sharkom/yii2-nested-sortable-widget
===================================

an implementation of nestedSortable2.0

v1.0.5(2y ago)0178BSD-4-ClausePHP

Since Sep 21Pushed 2mo agoCompare

[ Source](https://github.com/SharKom/yii2-nested-sortable-widget)[ Packagist](https://packagist.org/packages/sharkom/yii2-nested-sortable-widget)[ RSS](/packages/sharkom-yii2-nested-sortable-widget/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (7)Used By (0)

Nested Sortable
===============

[](#nested-sortable)

[![Latest Stable Version](https://camo.githubusercontent.com/6ef0578a4caedf5b4203cd1c34a71f16b1b84a25090af251798d38b20593ce88/68747470733a2f2f706f7365722e707567782e6f72672f736861726b6f6d2f796969322d6e65737465642d736f727461626c652f762f737461626c652e737667)](https://packagist.org/packages/sharkom/yii2-nested-sortable) [![Total Downloads](https://camo.githubusercontent.com/3822b20d2f01d359531f16c67f4d6ad01b79a44ad49a828320bee63c6befac9e/68747470733a2f2f706f7365722e707567782e6f72672f736861726b6f6d2f796969322d6e65737465642d736f727461626c652f646f776e6c6f6164732e737667)](https://packagist.org/packages/sharkom/yii2-nested-sortable) [![Latest Unstable Version](https://camo.githubusercontent.com/c629f7270b83ed7e608fde49cd173cab3502307fae754a72d04790afe4a14b5c/68747470733a2f2f706f7365722e707567782e6f72672f736861726b6f6d2f796969322d6e65737465642d736f727461626c652f762f756e737461626c652e737667)](https://packagist.org/packages/sharkom/yii2-nested-sortable) [![License](https://camo.githubusercontent.com/02ee3754345d32ca5f205bb0b78f966dca23e0824087323f05eaf9cd170965ce/68747470733a2f2f706f7365722e707567782e6f72672f736861726b6f6d2f796969322d6e65737465642d736f727461626c652f6c6963656e73652e737667)](https://packagist.org/packages/sharkom/yii2-nested-sortable)

an implementation of [nestedSortable2.0](http://ilikenwf.github.io/example.html)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist sharkom/yii2-nested-sortable "*"

```

or add

```
"sharkom/yii2-nested-sortable": "*"

```

to the require section of your `composer.json` file.

Prepare Model
-------------

[](#prepare-model)

In table migrateion:

```
$this->createTable('page', [
    'id'               => $this->primaryKey(),
    'title'            => $this->string(255)->notNull(),
    'parent_id'        => $this->integer()->null(),
    'weight'           => $this->integer(11)->notNull()->defaultValue(1),
]);

$this->createIndex('idx-page-parent_id', 'page', 'parent_id');
$this->addForeignKey('fk-page-parent_id-page-id', 'page', 'parent_id', 'page', 'id', 'SET NULL', 'CASCADE');
```

In ActiveRecord: [for more details on Customizing Query Classes](http://www.yiiframework.com/doc-2.0/guide-db-active-record.html#customizing-query-classes)

```
/**
* @inheridoc
*/
public static function find()
{
    return (new PageQuery(get_called_class()))->orderBy('weight');
}

/**
* @return ActiveQuery
*/
public function getParent()
{
   return $this->hasOne(Page::className(), ['id' => 'parent_id']);
}

/**
* @return ActiveQuery
*/
public function getPages()
{
   return $this->hasMany(Page::className(), ['parent_id' => 'id'])->inverseOf('parent');
}
```

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

In view:

```
use sharkom\yii2nestedSortable\NestedSortable;
echo NestedSortable::widget([
    'items'         => Page::find()->andWhere(['parent_id'=>null])->all(),
    'url'           => ['pages/save-sortable'],
    'contentAttribute' => 'title';
    'itemsAttribute' => 'pages';
]);
```

In controller:

```
public function actions()
{
    return [
        'save-sortable' => [
            'class' => 'sharkom\yii2nestedSortable\NestedSortableAction',
            //'scenario'=>'editable',  //optional
            'modelclass' => Page::className(),
        ],
    ];
}
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance56

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~513 days

Recently: every ~641 days

Total

6

Last Release

963d ago

### Community

Maintainers

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

---

Top Contributors

[![AndreaGvA](https://avatars.githubusercontent.com/u/1787039?v=4)](https://github.com/AndreaGvA "AndreaGvA (8 commits)")

---

Tags

yii2extensionnestedSortable2.0

### Embed Badge

![Health badge](/badges/sharkom-yii2-nested-sortable-widget/health.svg)

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

###  Alternatives

[richardfan1126/yii2-sortable-gridview

Sortable GridView for Yii2

29189.3k](/packages/richardfan1126-yii2-sortable-gridview)[sjaakp/yii2-taggable

Manage tags of ActiveRecord in Yii2.

3030.6k](/packages/sjaakp-yii2-taggable)[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)

PHPackages © 2026

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