slatiusa/yii2-nestable
Composer 安装命令:
composer require slatiusa/yii2-nestable
包简介
Yii 2.0 implementation of nested set behavior using jquery.nestable plugin.
README 文档
README
Yii 2.0 implementation of nested set behavior using jquery.nestable plugin.
- jquery.nestable plugin: http://dbushell.github.io/Nestable/
- Nested Sets Behavior for Yii 2: https://github.com/creocoder/yii2-nested-sets
Installation
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require slatiusa/yii2-nestable "dev-master"
or add
"slatiusa/yii2-nestable": "dev-master"
to the require section of your composer.json file.
Usage
Make sure you've attached the NestedSetsBehavior (creocoder/yii2-nested-sets) correctly to your model. Then add the node move handler to you controller by attaching the supplied action;
use slatiusa\nestable\Nestable;
class yourClass extends Controller
{
public function actions() {
return [
'nodeMove' => [
'class' => 'slatiusa\nestable\NodeMoveAction',
'modelName' => TreeModel::className(),
],
];
}
And then render the widget in your view;
echo Nestable::widget([
'type' => Nestable::TYPE_WITH_HANDLE,
'query' => TreeModel::find()->where([ top of tree ]),
'modelOptions' => [
'name' => 'name'
],
'pluginEvents' => [
'change' => 'function(e) {}',
],
'pluginOptions' => [
'maxDepth' => 7,
],
]);
You can either supply an ActiveQuery object in query from which a tree will be built.
You can also supply an item list;
...
'items' => [
['content' => 'Item # 1', 'id' => 1],
['content' => 'Item # 2', 'id' => 2],
['content' => 'Item # 3', 'id' => 3],
['content' => 'Item # 4 with children', 'id' => 4, 'children' => [
['content' => 'Item # 4.1', 'id' => 5],
['content' => 'Item # 4.2', 'id' => 6],
['content' => 'Item # 4.3', 'id' => 7],
]],
],
The modelOptions['name'] should hold an attribute name that will be used to name on the items in the list.
You can alternatively supply an unnamed function($model) to build your own content string.
Supply a pluginEvents['change'] with some JavaScript code to catch the change event fired by jquery.nestable plugin.
The pluginOptions accepts all the options for the original jquery.nestable plugin.
slatiusa/yii2-nestable 适用场景与选型建议
slatiusa/yii2-nestable 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 18.58k 次下载、GitHub Stars 达 17, 最近一次更新时间为 2015 年 04 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「jquery」 「sortable」 「extension」 「Behavior」 「nested set」 「widget」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 slatiusa/yii2-nestable 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 slatiusa/yii2-nestable 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 slatiusa/yii2-nestable 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Easily provide front-end sorting controls for SilverStripe lists
A custom URL rule class for Yii 2 which allows to create translated URL rules
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
TYPO3 CMS extension to create gallery content element with preset crop ratios and pagination
UI Kit 3 Extension for Yii2
统计信息
- 总下载量: 18.58k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 19
- 点击次数: 17
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: BSD
- 更新时间: 2015-04-27