This is an Yii framework 2.0 implementation of SortableJS extension. To create and reorder lists with drag-and-drop. For use with modern browsers and touch devices.
The preferred way to install this extension is through composer.
Either run
php composer.phar require toir427/yii2-sortablejs
or add
"toir427/yii2-sortablejs": "^1.0"
to the require section of your composer.json
file.
use toir427\sortablejs\Sortable;
<?= Sortable::widget([
'items' => [
'Item 1',
['content' => 'Item2'],
[
'content' => 'Item3',
'options' => ['class' => 'text-danger'],
],
],
'clientOptions' => [
'selectedClass' => 'selected',
'fallbackTolerance' => 3,
'animation' => 150,
],
]); ?>
More Examples.
For this extension configuration see SortableJS Options.
yii2-sortablejs is released under the Apache 2.0 License. See the LICENSE.md for details.