torfs-ict/ea-sortable-bundle
Composer 安装命令:
composer require torfs-ict/ea-sortable-bundle
包简介
Sortable entities in EasyAdmin bundle with drag-and-drop interface
README 文档
README
This bundle provides a convenient way to make your entities sortable as well as a drag-and-drop in the EasyAdmin list view.
The javascript and css was copied from treetop1500/easyadmin-dragndrop-sort with some minor improvements.
Installation
Install the bundle using composer:
$ composer req torfs-ict/ea-sortable-bundle
Add the bundle routing to config/routes.yaml:
ea-sortable: resource: '@OrkestraEaSortableBundle/Controller/' type: annotation
Usage
Using the sortable trait
Add the Orkestra\EaSortable\SortableTrait trait to your entity. Below is the sample configuration for
EasyAdmin.
easy_admin: entities: SortableEntity: class: App\Entity\SortableEntity list: sort: ['position', 'ASC'] actions: - delete - edit - new - search - { name: sort, template: '@OrkestraEaSortable/ea-sortable.html.twig' } fields: - { property: id, label: '$Id', sortable: false } - { property: name, label: Name, sortable: false }
Some notes about the configuration:
- setting the
sortoption is mandatory, obviously - you need to provide the custom
sortaction in order to enable the drag-and-drop functionality - sorting must be disabled on all other list fields (there is no way to do this globally in EasyAdmin)
Without the sortable trait
As long as your sorting property is called position you can simply follow the same steps as when
using the sortable trait. If not you need to do the following things:
- change the property in the
sortoption - configure the property on the
sortaction
The following example assumes the sorting property is named index.
easy_admin: entities: SortableEntity: class: App\Entity\SortableEntity list: sort: ['index', 'ASC'] actions: - delete - edit - new - search - { name: sort, template: '@OrkestraEaSortable/ea-sortable.html.twig', property: index } fields: - { property: id, label: '$Id', sortable: false } - { property: name, label: Name, sortable: false }
torfs-ict/ea-sortable-bundle 适用场景与选型建议
torfs-ict/ea-sortable-bundle 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 880 次下载、GitHub Stars 达 2, 最近一次更新时间为 2019 年 10 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 torfs-ict/ea-sortable-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 torfs-ict/ea-sortable-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 880
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-10-16