diselop/yii2-ztree

The zTree extension for the Yii framework

Maintainers

Package info

github.com/diselop/yii2-ztree

Language:CSS

Type:yii2-extension

pkg:composer/diselop/yii2-ztree

Statistics

Installs: 1 327

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-master 2015-05-20 05:52 UTC

This package is not auto-updated.

Last update: 2026-04-12 01:47:49 UTC


README

zTree is a multi-functional 'tree plug-ins.'

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist diselop/yii2-ztree "*"

or add

"diselop/yii2-ztree": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

<?= \diselop\ztree\Ztree::widget(['nodes'=>[
    'name'=>'cities','children'=>[
        ['name'=>'USA','children'=>[
            ['name'=>'New York'],
            ['name'=>'Los Angeles'],
            ['name'=>'Chicago'],
            ['name'=>'San Diego'],
        ]],
        ['name'=>'China','children'=>[
            ['name'=>'Beijing'],
            ['name'=>'Shanghai'],
            ['name'=>'Shenzhen'],
            ['name'=>'Gaozhou'],
        ]],
        ['name'=>'Russia','children'=>[
            ['name'=>'Moscow'],
            ['name'=>'Orenburg'],
            ['name'=>'Omsk'],
            ['name'=>'Samara'],
        ]],
    ]
]]);
?>