Open marcinmisiak opened 7 years ago
The same problem:
I wrote this, and it didn't show up:
'core' => [ 'data' => [ 'url' =>$url, ] ],
@russianlagman Can you help me?Thank you!
$data = ['text' => 'test']
$response = Yii::$app->response;
$response->format = \yii\web\Response::FORMAT_JSON;
$response->data = $data;
return $response;
if jstree doc we have: // AJAX $('#tree').jstree({ 'core' : { 'data' : { 'url' : '/get/children/', 'data' : function (node) { return { 'id' : node.id }; } } });
You can not configure widget like this: [ 'data' => [ 'url' => Utr:to['tree/ajax']), data =>'function (node) { return { 'id' : node.id }; }' ] because Json::encode always add quotas ("). JavaScript send to browser:
$.jstree( ... "data": { "url": "http://www", "data":"function (node) { return { 'id' : node.id }; }" } but we need: $.jstree( ... "data": { "url": "http://www", "data": function (node) { return { 'id' : node.id }; } }