定制 ereminmdev/yii2-sortablejs 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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 destroyOldBeforeThis widget option to true

统计信息

  • 总下载量: 1.49k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-07-18