The yii2-fancytree-widget is a Yii 2 wrapper for the Fancytree. A JavaScript dynamic tree view plugin for jQuery with support for persistence, keyboard, checkboxes, tables, drag'n'drop, and lazy loading., (*1)
Note
orinal soure file => wbraganca/yii2-fancytree-widget thank you.
this is version i'm solve for my server., (*2)
Installation
The preferred way to install this extension is through composer., (*3)
Either run, (*4)
php composer.phar require --prefer-dist prawee/yii2-fancytree-widget "*"
or add, (*5)
"prawee/yii2-fancytree-widget": "*"
to the require section of your composer.json
file., (*6)
How to use
On your view file., (*7)
'Node 1', 'key' => 1],
['title' => 'Folder 2', 'key' => '2', 'folder' => true, 'children' => [
['title' => 'Node 2.1', 'key' => '3'],
['title' => 'Node 2.2', 'key' => '4']
]]
];
echo \wbraganca\fancytree\FancytreeWidget::widget([
'options' =>[
'source' => $data,
'extensions' => ['dnd'],
'dnd' => [
'preventVoidMoves' => true,
'preventRecursiveMoves' => true,
'autoExpandMS' => 400,
'dragStart' => new JsExpression('function(node, data) {
return true;
}'),
'dragEnter' => new JsExpression('function(node, data) {
return true;
}'),
'dragDrop' => new JsExpression('function(node, data) {
data.otherNode.moveTo(node, data.hitMode);
}'),
],
]
]);
?>