T
T
Tat622018-12-28 13:31:29
Yii
Tat62, 2018-12-28 13:31:29

How to properly set up jsTree-yii2 from dreamteam?

I need to use category tree with checkbox and json data. I am using \yiidreamteam\jstree\JsTree::widget. Theoretically, it is clear - you need to set up jstree: install the plugin with the checkbox, specify the address of the json file and install the widget in the view. But I'm not sure if I installed the checkbox plugin correctly. The json file address should be put instead of \yii\helpers\Url::to(['ajax/tree']). So or not? If everything is correct, then through the controller to receive / transmit data in json format. Tell me, please, if I think correctly. If not, please tell me what to do. Here is the widget in use:

<?= \yiidreamteam\jstree\JsTree::widget([
    'containerOptions' => [
        'class' => 'data-tree',
    ],
    'jsOptions' => [
        'core' => [
            'multiple' => false,
            'data' => [
                'url' => \yii\helpers\Url::to(['ajax/tree']),
            ],
            'themes' => [
                'name' => 'foobar',
                'url' => "/themes/foobar/js/jstree3/style.css",
                'dots' => true,
                'icons' => false,
            ],
            "plugins" => [	"checkbox"]
        ],
    ]
]) ?>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question