2017 © Pedro Peláez
 

yii2-extension yii2-sortable-list-view-widget

Sortable modification of standard Yii2 ListView widget

image

handysolver/yii2-sortable-list-view-widget

Sortable modification of standard Yii2 ListView widget

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 8 % Grown

The README.md

Sortable ListView Widget for Yii2

Sortable modification of standard Yii2 ListView widget., (*1)

Credits

This library has been picked up from himiklab's gridview sortable and has been customised to work with ListView. Great work himiklab!, (*2)

Installation

The preferred way to install this extension is through composer., (*3)

  • Either run
php composer.phar require --prefer-dist "handysolver/yii2-sortable-list-view-widget" "*"

or add, (*4)

"handysolver/yii2-sortable-list-view-widget" : "*"

to the require section of your application's composer.json file., (*5)

  • Add to your database new unsigned int attribute, such sortOrder., (*6)

  • Add new behavior in the AR model, for example:, (*7)

use handysolver\sortablelist\SortableListBehavior;

public function behaviors()
{
    return [
        'sort' => [
            'class' => SortableListBehavior::className(),
            'sortableAttribute' => 'sortOrder'
        ],
    ];
}
  • Add action in the controller, for example:
use handysolver\sortablelist\SortableListAction;

public function actions()
{
    return [
        'sort' => [
            'class' => SortableListAction::className(),
            'modelName' => Model::className(),
        ],
    ];
}

Usage

  • Use SortableListView as standard ListView with sortableAction option. You can also subscribe to the JS event 'sortableSuccess' generated widget after a successful sorting.

The Versions

05/09 2017

dev-master

9999999-dev

Sortable modification of standard Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

yii2 widget list sortable listview