2017 © Pedro Peláez
 

yii2-extension yii2-bootstrap-tree

A bootstrap tree for both jonmiles bootstrap treeview 1.2.0 and 2.0.0 (https://github.com/jonmiles/bootstrap-treeview)

image

yongtiger/yii2-bootstrap-tree

A bootstrap tree for both jonmiles bootstrap treeview 1.2.0 and 2.0.0 (https://github.com/jonmiles/bootstrap-treeview)

  • Monday, April 24, 2017
  • by yongtiger
  • Repository
  • 1 Watchers
  • 2 Stars
  • 885 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 37 % Grown

The README.md

yii2-bootstrap-tree release version 1.0.2 (typo)

A bootstrap tree for jonmiles bootstrap treeview BOTH 1.2.0 and 2.0.0 (https://github.com/jonmiles/bootstrap-treeview). Forked and improved from dmitry-suffi/yii-tree-widget and lesha724/yii2-bootstrap-tree., (*1)

Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

FEATURES

  • for jonmiles bootstrap treeview BOTH 1.2.0 and 2.0.0 (https://github.com/jonmiles/bootstrap-treeview)
  • automatically displaying selected nodes according to route/params (e.g. id)

DEPENDENCES

  • jonmiles bootstrap treeview 1.2.0 or 2.0.0 (https://github.com/jonmiles/bootstrap-treeview)

INSTALLATION

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist yongtiger/yii2-bootstrap-tree "*"

or add, (*5)

"yongtiger/yii2-bootstrap-tree": "*"

to the require section of your composer.json., (*6)

CONFIGURATION

USAGES

Example of data.$items structure (https://github.com/jonmiles/bootstrap-treeview#data-structure):

$items = [
    [
        'text' => 'Node 1',                                 ///(needed!)
        'href' => ['site/index', id => 1],                  ///(optional) Note: `href` must be route array!
        'icon' => 'glyphicon glyphicon-stop',               ///(optional)
        'selectedIcon' => "glyphicon glyphicon-stop",       ///(optional)
        'selectable' => true,                               ///(optional)
        'state' => [                                        ///(optional)
            // 'checked' => true,
            // 'disabled' => true,
            // 'expanded' => true,
            // 'selected' => true,
        ],
        'tags' => ['available'],                            ///(optional)

        'visible' => true,                                  ///(optional) same as [yii\widgets\Menu::$visible]
        'encode' => true,                                   ///(optional) same as [yii\widgets\Menu::$encode]
        // ...
        'nodes' =>
        [
            ['text' => 'Node 1.1', 'href' => ['site/index', id => 2]],
            ['text' => 'Node 1.2', 'href' => ['site/index', id => 3]],
        ]
    ],
    [
        'text' => 'Node 2',
        'href' => ['site/index', id => 4],
        'nodes' => [
            ['text' => 'Node 2.1', 'href' => ['site/index', id => 5]],
            ['text' => 'Node 2.2', 'href' => ['site/index', id => 6]],
        ]
    ],
    // ...
];
echo \yongtiger\bootstraptree\widgets\BootstrapTree::widget([
    'options'=>[
        //https://github.com/jonmiles/bootstrap-treeview#options
        'data' => $items,                                   ///(needed!)
        'enableLinks' => true,                              ///(optional)
        'showTags' => true,                                 ///(optional)
        'levels' => 3,                                      ///(optional)
        'multiSelect' => true,  ///(optional, but when `selectParents` is true, you must also set this to true!)
    ],
    'htmlOptions' => [                                      ///(optional)
        'id' => 'treeview-tabs',
    ],
    'events'=>[                                             ///(optional)
        //https://github.com/jonmiles/bootstrap-treeview#events
        'onNodeSelected'=>'function(event, data) {
            // Your logic goes here
            alert(data.text);
        }'
    ],

    ///(needed for using jonmiles bootstrap-treeview 2.0.0, must specify it as `<a href="{href}">{text}</a>`)
    'textTemplate' => '<a href="{href}">{text}</a>',

    ///(optional) Note: when it is true, you must also set `multiSelect` of the treeview widget options to true!
    'selectParents' => true,
]);

Other usages are just same as yii\widgets\Menu.

NOTES

  • href has been obsoleted in jonmiles bootstrap-treeview 2.0.0. You can specify textTemplate as <a href="{href}">{text}</a> in the treeview widget options to generate the url of node.

DOCUMENTS

REFERENCES

  • https://github.com/dmitry-suffi/yii-tree-widget
  • https://github.com/lesha724/yii2-bootstrap-tree

SEE ALSO

TBD

Development roadmap

LICENSE

yii2-bootstrap-tree is released under the MIT license, see LICENSE file for details., (*16)

The Versions

24/04 2017

dev-master

9999999-dev http://www.branbook.cc

A bootstrap tree for both jonmiles bootstrap treeview 1.2.0 and 2.0.0 (https://github.com/jonmiles/bootstrap-treeview)

  Sources   Download

MIT

The Requires

 

extension yii2 bootstrap widget tree treeview

24/04 2017

1.0.2

1.0.2.0 http://www.branbook.cc

A bootstrap tree for both jonmiles bootstrap treeview 1.2.0 and 2.0.0 (https://github.com/jonmiles/bootstrap-treeview)

  Sources   Download

MIT

The Requires

 

extension yii2 bootstrap widget tree treeview

18/04 2017

1.0.1

1.0.1.0 http://www.branbook.cc

A bootstrap tree for both jonmiles bootstrap treeview 1.2.0 and 2.0.0 (https://github.com/jonmiles/bootstrap-treeview)

  Sources   Download

MIT

The Requires

 

extension yii2 bootstrap widget tree treeview

17/04 2017

1.0.0

1.0.0.0 http://www.branbook.cc

A bootstrap tree for both jonmiles bootstrap treeview 1.2.0 and 2.0.0 (https://github.com/jonmiles/bootstrap-treeview)

  Sources   Download

MIT

The Requires

 

extension yii2 bootstrap widget tree treeview

16/04 2017

v0.0.2

0.0.2.0 http://www.branbook.cc

A bootstrap tree for Yii2 (https://github.com/jonmiles/bootstrap-treeview)

  Sources   Download

MIT

The Requires

 

extension yii2 bootstrap widget tree treeview

16/04 2017

v0.0.1

0.0.1.0 http://www.branbook.cc

A bootstrap tree for Yii2 (https://github.com/jonmiles/bootstrap-treeview)

  Sources   Download

MIT

The Requires

 

extension yii2 bootstrap tree

16/04 2017

v0.0.0

0.0.0.0 http://www.branbook.cc

A bootstrap tree for Yii2 (https://github.com/jonmiles/bootstrap-treeview)

  Sources   Download

MIT

The Requires

 

extension yii2 bootstrap tree