ereminmdev/yii2-sortablejs
最新稳定版本:v1.0.15
Composer 安装命令:
composer require ereminmdev/yii2-sortablejs
包简介
Sortable assert for Yii framework.
README 文档
README
Reorderable drag-and-drop lists widget for Yii framework.
Based on JavaScript library: https://github.com/RubaXa/Sortable
Install
composer require --prefer-dist ereminmdev/yii2-sortablejs
Documentation
ClientOptions: https://github.com/RubaXa/Sortable#sortable
Use
Insert widget into view:
<?= \ereminmdev\yii2\sortablejs\SortableJs::widget([
'elementSelector' => '.items',
'clientOptions' => [
'handle' => '.item-handle',
],
]) ?>
or with SortableJsAction action:
- add action to controller:
public function actions()
{
return [
'sortable' => [
'class' => 'ereminmdev\yii2\sortablejs\SortableJsAction',
],
];
}
- add widget into view:
<?= SortableJs::widget([
'elementSelector' => '.items',
'storeSetAction' => Url::toRoute(['/site/sortable', 'model' => Product::class]),
]) ?>
Tips
To refresh after ajax:
- add into view before widget
$this->registerJs('if (Sortable.active) Sortable.active.destroy();');
- or set
destroyOldBeforeThiswidget option totrue
统计信息
- 总下载量: 1.49k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-07-18