2017 © Pedro Peláez
 

library yii2dynatree

Tree widget for Yii2

image

andkon/yii2dynatree

Tree widget for Yii2

  • Wednesday, April 26, 2017
  • by andkon13
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2,708 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 18 % Grown

The README.md

yii2dynatree

docs:
    http://wwwendt.de/tech/dynatree/
demo:
    http://andkon.bl.ee/index.php?r=store

install:

php composer.phar require "andkon/yii2dynatree": "dev-master"

Как использовать/How to use

Model:
need attributes:
    id - primary key
    parent_id - FK to id
    sort - INT order in tree
    name - STRING as label
you can override the field names 
attribs
$pkField 
$parentField 
$sortField 

Controller:
class UnitController extends Controller
{
    ...
    public function actions()
    {
        $actions               = parent::actions();
        $actions['moveintree'] = 'andkon\yii2dynatree\actions\MoveInTree';
        
        // or
        $actions['moveintree'] = [
            'class' => andkon\yii2dynatree\actions\MoveInTree',
            'sortField' => 'order', // override field name
        ];

        return $actions;
    }
    ...
}

Widget:
class Tree extends \andkon\yii2dynatree\Tree
{
    public function init()
    {
        parent::init();
        $this->functions['onClick'] = 'function (node, event) {
            unit.showDetal(node.data.key);
        }';
    }
}

View:
echo \app\pathToWidget\Tree::widget(
    [
        'id'      => 'treeId',
        'isAjax'  => true, // true for use ajax load widget (in dialog|popup etc.) or false for standart render
        'ajaxUrl' => Yii::$app->getUrlManager()->createUrl('/pathToController/moveintree'),
        'model'   => $model,
    ]
);

The Versions

26/04 2017

dev-master

9999999-dev

Tree widget for Yii2

  Sources   Download

proprietary

The Requires

  • php >=5.4.0

 

by Andrey Konenkov

10/09 2014

dev-beta

dev-beta

Tree widget for Yii2

  Sources   Download

proprietary

The Requires

  • php >=5.4.0

 

by Andrey Konenkov