execut/yii2-widget-bootstraptreeview
Composer 安装命令:
composer require execut/yii2-widget-bootstraptreeview
包简介
Bootstrap Tree View widget wrapper for yii2
README 文档
README
Installation
The preferred way to install this extension is through composer.
Install
Either run
$ php composer.phar require execut/yii2-widget-bootstraptreeview "dev-master"
or add
"execut/yii2-widget-bootstraptreeview": "dev-master"
to the require section of your composer.json file.
Simple example
use execut\widget\TreeView; use yii\web\JsExpression; $data = [ [ 'text' => 'Parent 1', 'nodes' => [ [ 'text' => 'Child 1', 'nodes' => [ [ 'text' => 'Grandchild 1' ], [ 'text' => 'Grandchild 2' ] ] ], [ 'text' => 'Child 2', ] ], ], [ 'text' => 'Parent 2', ] ]; $onSelect = new JsExpression(<<<JS function (undefined, item) { console.log(item); } JS ); $groupsContent = TreeView::widget([ 'data' => $data, 'size' => TreeView::SIZE_SMALL, 'header' => 'Categories', 'searchOptions' => [ 'inputOptions' => [ 'placeholder' => 'Search category...' ], 'clearButtonOptions' => [ 'title' => 'Clear', ], ], 'clientOptions' => [ 'onNodeSelected' => $onSelect, 'selectedBackColor' => 'rgb(40, 153, 57)', 'borderColor' => '#fff', ], ]); echo $groupsContent;
Pjax navigation example
use yii\widgets\Pjax; use yii\web\JsExpression; use execut\widget\TreeView; use yii\helpers\Url; Pjax::begin([ 'id' => 'pjax-container', ]); echo \yii::$app->request->get('page'); Pjax::end(); $onSelect = new JsExpression(<<<JS function (undefined, item) { if (item.href !== location.pathname) { $.pjax({ container: '#pjax-container', url: item.href, timeout: null }); } var otherTreeWidgetEl = $('.treeview.small').not($(this)), otherTreeWidget = otherTreeWidgetEl.data('treeview'), selectedEl = otherTreeWidgetEl.find('.node-selected'); if (selectedEl.length) { otherTreeWidget.unselectNode(Number(selectedEl.attr('data-nodeid'))); } } JS ); $items = [ [ 'text' => 'Parent 1', 'href' => Url::to(['', 'page' => 'parent1']), 'nodes' => [ [ 'text' => 'Child 1', 'href' => Url::to(['', 'page' => 'child1']), 'nodes' => [ [ 'text' => 'Grandchild 1', 'href' => Url::to(['', 'page' => 'grandchild1']) ], [ 'text' => 'Grandchild 2', 'href' => Url::to(['', 'page' => 'grandchild2']) ] ] ], ], ], ]; echo TreeView::widget([ 'data' => $items, 'size' => TreeView::SIZE_SMALL, 'clientOptions' => [ 'onNodeSelected' => $onSelect, ], ]);
Changing widget template
You can redefine widget template via template option:
echo TreeView::widget([ ... 'template => TreeView::TEMPLATE_SIMPLE, //'template => TreeView::TEMPLATE_ADVANCED //by default ... ]);
Supported template parts:
| Key | Description |
|---|---|
| {header} | 'header' configuration widget param |
| {search} | Search input |
| {tree} | Bootstrap TreeView widget content |
License
yii2-widget-bootstraptreeview is released under the Apache License Version 2.0. See the bundled LICENSE.md for details.
execut/yii2-widget-bootstraptreeview 适用场景与选型建议
execut/yii2-widget-bootstraptreeview 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 175.32k 次下载、GitHub Stars 达 46, 最近一次更新时间为 2015 年 04 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「tree」 「jquery」 「plugin」 「form」 「bootstrap」 「extension」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 execut/yii2-widget-bootstraptreeview 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 execut/yii2-widget-bootstraptreeview 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 execut/yii2-widget-bootstraptreeview 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
jsTree widget for yii2
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
Doctrine2 behavior traits - slowhop fork
This is a laravel 4 package for the server and client side of datatables at http://datatables.net/
A fast and dynamic Merkle tree implementation
统计信息
- 总下载量: 175.32k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 47
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2015-04-27