raoul2000/yii2-html5sortable-widget
Composer 安装命令:
composer require raoul2000/yii2-html5sortable-widget
包简介
Wrapper around the HTML5sortable JQuery plugin
README 文档
README
Wrapper around "HTML5 Sortable", a jQuery plugin to create sortable lists and grids using native HTML5 drag and drop API.
Check out the HTML5 Sortable for demo of the Plugin.
Please note that this extension does not provide any aditionnal feature than the one available in the wrapped plugin. It has no other dependency than the Yii2 Framework
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist raoul2000/yii2-html5sortable-widget "*"
or add
"raoul2000/yii2-html5sortable-widget": "*"
to the require section of your composer.json file.
Usage
This is an example no how to use this extension once it is installed. First, create an HTML bootstrap list group :
<ul class="list-group sortable" style="min-height: 42px;"> <li class="list-group-item"><span class="glyphicon glyphicon-align-justify"></span> Cras justo odio</li> <li class="list-group-item disabled "><span class="glyphicon glyphicon-align-justify"></span> can't be dragged because of disabled class</li> <li class="list-group-item"><span class="glyphicon glyphicon-align-justify"></span> Morbi leo risus</li> <li class="list-group-item"><span class="glyphicon"></span>can't be dragged because the handle is missing !</li> <li class="list-group-item"><span class="glyphicon glyphicon-align-justify"></span> Vestibulum at eros</li> </ul>
Then let's add some styling so our list items render nicely when drag and dropped :
li.list-group-item { height:42px; } li.sortable-placeholder { border: 1px dashed #CCC; background: #eeeeee; height:42px; list-style: none; }
Finally, make is HTML 5 Sortable by inserting following code :
<?php echo raoul2000\widget\html5sortable\Html5Sortable::widget([ 'selector' => '.sortable', 'sortupdate' => new yii\web\JsExpression('function(){console.log("update");}'), 'pluginOptions' => [ 'handle' => '.glyphicon-align-justify', 'items' => ':not(.disabled)' ] ]); ?>
For more information on the plugin options and usage, please refer to html5sortable@github.
License
yii2-html5sortable-widget is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.
统计信息
- 总下载量: 35
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2014-06-28