2017 © Pedro Peláez
 

yii2-extension yii2-sortable-widgets

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

image

kotchuprik/yii2-sortable-widgets

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

  • Wednesday, November 29, 2017
  • by kotchuprik
  • Repository
  • 12 Watchers
  • 51 Stars
  • 11,989 Installations
  • PHP
  • 5 Dependents
  • 0 Suggesters
  • 22 Forks
  • 1 Open issues
  • 11 Versions
  • 16 % Grown

The README.md

Yii2 Sortable widgets

Join the chat at https://gitter.im/kotchuprik/yii2-sortable-widgets, (*1)

Implementation Rubaxa/Sortable for Yii2 widgets., (*2)

Supported:, (*3)

  • GridView widget.

demo, (*4)

Latest Stable Version Total Downloads Monthly Downloads Latest Unstable Version License, (*5)

Usage

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

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:, (*7)

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:, (*8)

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:, (*9)

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:, (*10)

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:, (*11)

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

The Versions

29/11 2017

dev-master

9999999-dev http://github.com/kotchuprik/yii2-sortable-widgets

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

  Sources   Download

MIT

The Requires

 

yii2 grid sortable dnd jqueryui gridview sorting rubaxa

29/11 2017

v2.0.7

2.0.7.0 http://github.com/kotchuprik/yii2-sortable-widgets

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

  Sources   Download

MIT

The Requires

 

yii2 grid sortable dnd jqueryui gridview sorting rubaxa

17/11 2017

v2.0.6

2.0.6.0 http://github.com/kotchuprik/yii2-sortable-widgets

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

  Sources   Download

MIT

The Requires

 

yii2 grid sortable dnd jqueryui gridview sorting rubaxa

16/11 2017

v2.0.5

2.0.5.0 http://github.com/kotchuprik/yii2-sortable-widgets

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

  Sources   Download

MIT

The Requires

 

yii2 grid sortable dnd jqueryui gridview sorting rubaxa

15/05 2017

v2.0.4

2.0.4.0 http://github.com/kotchuprik/yii2-sortable-widgets

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

  Sources   Download

MIT

The Requires

 

yii2 grid sortable dnd jqueryui gridview sorting rubaxa

28/03 2017

v2.0.3

2.0.3.0 http://github.com/kotchuprik/yii2-sortable-widgets

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

  Sources   Download

MIT

The Requires

 

yii2 grid sortable dnd jqueryui gridview sorting rubaxa

10/06 2016

v2.0.2

2.0.2.0 http://github.com/kotchuprik/yii2-sortable-widgets

Implementation the jQuery UI Sortable for the Yii2 widgets. Sortable grid view.

  Sources   Download

MIT

The Requires

 

by Constantin Chuprik

yii2 grid sortable dnd jqueryui gridview sorting

28/08 2015

v2.0.1

2.0.1.0 http://github.com/kotchuprik/yii2-sortable-widgets

Implementation the jQuery UI Sortable for the Yii2 widgets. Sortable grid view.

  Sources   Download

MIT

The Requires

 

by Constantin Chuprik

yii2 grid sortable dnd jqueryui gridview sorting

10/08 2015

v2.0.0

2.0.0.0 http://github.com/kotchuprik/yii2-sortable-widgets

Implementation the jQuery UI Sortable for the Yii2 widgets. Sortable grid view.

  Sources   Download

MIT

The Requires

 

by Constantin Chuprik

yii2 grid sortable dnd jqueryui gridview sorting

21/03 2015

1.0.1

1.0.1.0 http://github.com/kotchuprik/yii2-sortable-widgets

Implementation the jQuery UI Sortable for the Yii2 widgets. Sortable grid view.

  Sources   Download

MIT

The Requires

 

by Constantin Chuprik

yii2 grid sortable dnd jqueryui gridview sorting

14/10 2014

1.0

1.0.0.0 http://github.com/kotchuprik/yii2-sortable-widgets

Implementation the jQuery UI Sortable for the Yii2 widgets. Sortable grid view.

  Sources   Download

MIT

The Requires

 

by Constantin Chuprik

yii2 grid sortable dnd jqueryui gridview sorting