javascript 以编程方式在jstree中添加节点
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29847867/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
programmatically add Node in jstree
提问by Sunil Madan
回答by vakata
Here is your fiddle, fixed to work: http://jsfiddle.net/3q9Ma/223/
这是你的小提琴,固定工作:http: //jsfiddle.net/3q9Ma/223/
You were calling create_node
with an array, which was wrong, also the string value 'null'
was not the correct way to create a root node - use the special string value '#'
(in later versions null
works too, but not as a string).
您正在create_node
使用数组调用,这是错误的,字符串值'null'
也不是创建根节点的正确方法 - 使用特殊字符串值'#'
(在更高版本中null
也可以使用,但不能作为字符串)。
You might consider upgrading the jstree version - your fiddle was using a very early beta. Also keep in mind jstree itself does not require Angular.
您可能会考虑升级 jstree 版本 - 您的小提琴使用的是非常早期的测试版。还要记住 jstree 本身不需要 Angular。