Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yii2mod/yii2-tree
Tree widget based on Fancytree extension
https://github.com/yii2mod/yii2-tree
yii2 yii2-extension yii2-tree yii2-tree-widget
Last synced: about 10 hours ago
JSON representation
Tree widget based on Fancytree extension
- Host: GitHub
- URL: https://github.com/yii2mod/yii2-tree
- Owner: yii2mod
- License: mit
- Created: 2014-12-10T12:38:02.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-11-23T10:59:18.000Z (almost 7 years ago)
- Last Synced: 2024-09-23T15:39:02.451Z (10 days ago)
- Topics: yii2, yii2-extension, yii2-tree, yii2-tree-widget
- Language: PHP
- Homepage:
- Size: 33.2 KB
- Stars: 21
- Watchers: 9
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Yii2 Tree Widget
Tree widget based on Fancytree extension http://wwwendt.de/tech/fancytree/demo/#sample-default.html
[![Latest Stable Version](https://poser.pugx.org/yii2mod/yii2-tree/v/stable)](https://packagist.org/packages/yii2mod/yii2-tree)
[![Total Downloads](https://poser.pugx.org/yii2mod/yii2-tree/downloads)](https://packagist.org/packages/yii2mod/yii2-tree)
[![License](https://poser.pugx.org/yii2mod/yii2-tree/license)](https://packagist.org/packages/yii2mod/yii2-tree)
[![Build Status](https://travis-ci.org/yii2mod/yii2-tree.svg?branch=master)](https://travis-ci.org/yii2mod/yii2-tree)Installation
------------The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require --prefer-dist yii2mod/yii2-tree "*"
```or add
```
"yii2mod/yii2-tree": "*"
```to the require section of your composer.json.
Usage
------------
Once the extension is installed, simply add widget to your page as follows:```php
[
['title' => 'Category 1'],
['title' => 'Category 2'],
[
'title' => 'Category 3',
'children' => [
[
'title' => 'Category 3.1',
],
[
'title' => 'Category 3.2',
'children' => [
[
'title' => 'Category 3.2.1',
]
],
'folder' => true,
],
],
'folder' => true,
],],
'clientOptions' => [
'autoCollapse' => true,
'clickFolderMode' => 3,
'activate' => new \yii\web\JsExpression('
function(node, data) {
node = data.node;
// Log node title
console.log(node.title);
}
'),
],
]); ?>
```**You can also change the theme of Fancytree extension!**
To change the theme, you can configure the assetManager array in your application configuration:
```php
// skin-win8'assetManager' => [
'bundles' => [
'yii2mod\tree\TreeAsset' => [
'css' => [
'skin-win8/ui.fancytree.less',
]
],
],
]
```