You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Приветствую, Иван.
Я слегка изменил пример таким образом чтобы рутами могли быть только ноды типа "folder":
Но в результате ноды типа "question" все еще пытаются развернуться, несмотря на "valid_children" : "none". При этом видно, что картинка подцепилась (404.png ведет "вникуда") Использую jsTree 1.0-rc3:
$(function(){$("#tree").jstree({// List of active plugins"plugins" : ["json_data","themes","types"],// the core plugin - not many options here"core" : {},// I usually configure the plugin that handles the data first// This example uses JSON as it is most common"json_data" : {// This tree is ajax enabled - as this is most common, and maybe a bit more complex// All the options are almost the same as jQuery's AJAX (read the docs)"ajax" : {// the URL to fetch the data"url" : "@{Tree.getChildren()}",// the `data` function is executed in the instance's scope// the parameter is the node being loaded // (may be -1, 0, or undefined when loading the root nodes)"data" : function(n){// the result is fed to the AJAX request `data` optionreturn{"id" : n.attr ? n.attr("id").replace("node_","") : -1};}}},// Using types - most of the time this is an overkill// read the docs carefully to decide whether you need types"types" : {// I set both options to -2, as I do not need depth and children count checking// Those two checks may slow jstree a lot, so use only when needed"max_depth" : -2,"max_children" : -2,// I want only `folder` nodes to be root nodes // This will prevent moving or creating any other type as a root node"valid_children" : ["folder"],"types" : {// The question type"question" : {// I want this type to have no children (so only leaf nodes)// In my case - those are questions"valid_children" : "none","icon" : {"image" : "404.png"}},// The `folder` type"folder" : {// can have questions and other folders inside of it"valid_children" : ["question","folder"]}}}});});
Пример передаваемого json для второго уровня: [{"data":"test","attr":{"id":"1","rel":"question"},"state":"closed"},{"data":"123","attr":{"id":"2","rel":"question"},"state":"closed"}]
The text was updated successfully, but these errors were encountered:
Sorry, but my Russian is very bad :) I understood what you mean ... but I cannot answer in russian ... Use "./404.png" as mentioned in the docs.
As for valid children - it will not filter out the nodes that are already there, but will prevent the user from moving or creating new ones.
Приветствую, Иван.
Я слегка изменил пример таким образом чтобы рутами могли быть только ноды типа "folder":
Но в результате ноды типа "question" все еще пытаются развернуться, несмотря на "valid_children" : "none". При этом видно, что картинка подцепилась (404.png ведет "вникуда") Использую jsTree 1.0-rc3:
Пример передаваемого json для второго уровня:
[{"data":"test","attr":{"id":"1","rel":"question"},"state":"closed"},{"data":"123","attr":{"id":"2","rel":"question"},"state":"closed"}]
The text was updated successfully, but these errors were encountered: