yii2-sortable Create sortable lists and grids using simple drag and drop.

  1. Demo
  2. Installation
  3. Usage
  4. Report
  5. License
  6. Resources

The yii2-sortable extension is a widget allows you to create sortable lists and grids and manipulate them using simple drag and drop. It is based on the lightweight html5sortable jQuery plugin, which uses native HTML5 API for drag and drop. It is a leaner alternative for the JUI Sortable plugin and offers very similar functionality. The widget offers these features:

  • Less than 1KB of javascript used (minified and gzipped).
  • Built using native HTML5 drag and drop API.
  • Supports both list and grid style layouts.
  • Similar API and behaviour to jquery-ui sortable plugin.
  • Works in IE 5.5+, Firefox 3.5+, Chrome 3+, Safari 3+ and, Opera 12+.

Note: This extension depends on the kartik-v/yii2-widgets extension which in turn depends on the yiisoft/yii2-bootstrap extension. Check the composer.json for this extension's requirements and dependencies. Note: Yii 2 framework is still in active development, and until a fully stable Yii2 release, your core yii2-bootstrap packages (and its dependencies) may be updated when you install or update this extension. You may need to lock your composer package versions for your specific app, and test for extension break if you do not wish to auto update dependencies.

Demo

You can see detailed documentation and demonstration on usage of the extension.

Installation

The preferred way to install this extension is through composer.

Either run:

$ php composer.phar require kartik-v/yii2-sortable "*"

or add:

"kartik-v/yii2-sortable": "*"

to the require section of your composer.json file.

Usage

use kartik\sortable\Sortable;
echo Sortable::widget([
    'type' => Sortable::TYPE_LIST,
    'items' => [
        ['content' => 'Item # 1'],
        ['content' => 'Item # 2'],
        ['content' => 'Item # 3'],
    ]   
]); 

Report

License

yii2-sortable is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.

Resources

2 0
40 followers
0 downloads
Yii Version: 2.0
License: BSD-2-Clause
Category: User Interface
Developed by: Kartik V
Created on: May 28, 2014
Last updated: 9 years ago

Related Extensions