Download the PHP package rootlocal/yii2-jstree without Composer
On this page you can find all versions of the php package rootlocal/yii2-jstree. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package yii2-jstree
yii2-jstree jsTree is jquery plugin for Yii2
Install
or add
"rootlocal/yii2-jstree" : "dev-master",
to the require section of your composer.json.
View
<?= JstreeWidget::widget([
'theme' => JsTreeWidget::THEME_BOOTSTRAP3,
'url' => Url::to(['tree/explorer-request']),
'plugins' => ['dnd'],
'actions' => [
'rename' => [
'url' => Url::to(['tree/rename-node']),
'label' => 'Rename',
'icon' => 'glyphicon glyphicon-pencil',
],
'remove' => [
'url' => Url::to(['tree/delete-node']),
'label' => 'Remove',
'icon' => 'glyphicon glyphicon-remove',
],
'select' => [
'url' => Url::to('menu/update'),
],
'move' => [
'url' => Url::to(['tree/move-node']),
]
],
'types' => [
'child' => ['icon' => 'glyphicon glyphicon-leaf'],
'root' => ['icon' => 'glyphicon glyphicon-folder-open'],
],
]) ?>
TreeController
use yii\web\Controller;
class TreeController extends Controller {
// ...
/**
* Request tree
* @param string|int $id
* @return array
*/
public function actionExplorerRequest($id = '#'): array
{
if (Yii::$app->request->isPjax || Yii::$app->request->isAjax) {
Yii::$app->response->format = Response::FORMAT_JSON;
}
$data = [];
if ($id === '#') {
$children = Menu::find()->roots()->orderBy(['id' => SORT_ASC])->all();
foreach ($children as $child) {
$childrenCount = $child->getChildren()->count();
$data[] = [
'id' => $child->id,
'text' => $child->name,
'children' => $childrenCount > 0,
//'icon' => 'glyphicon glyphicon-folder-close',
'type' => $childrenCount > 0 ? '' : 'child',
];
}
return $data;
}
$root = Menu::findOne($id);
$data['id'] = $id;
$data['text'] = $root->name;
$data['children'] = [];
$children = $root->getChildren()->all();
foreach ($children as $child) {
$childrenCount = Menu::findOne($child['id'])->getChildren()->count();
$data['children'][] = [
'id' => $child->id,
'text' => $child->name,
'children' => $childrenCount > 0,
//'icon' => 'glyphicon glyphicon-folder-close',
'type' => $childrenCount > 0 ? '' : 'child',
];
}
return $data;
}
}
All versions of yii2-jstree with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.4.0
yiisoft/yii2 Version ~2.0.45
bower-asset/jstree Version ~3
bower-asset/jquery.hotkeys Version dev-master
bower-asset/jquery.cookie Version >=1.4
bower-asset/jstree-bootstrap-theme Version ~1.0.2
loveorigami/yii2-modal-ajax Version @dev
yiisoft/yii2 Version ~2.0.45
bower-asset/jstree Version ~3
bower-asset/jquery.hotkeys Version dev-master
bower-asset/jquery.cookie Version >=1.4
bower-asset/jstree-bootstrap-theme Version ~1.0.2
loveorigami/yii2-modal-ajax Version @dev
The package rootlocal/yii2-jstree contains the following files
Loading the files please wait ....