JSTree 默认展开 树节点默认展开

我不是女神ヾ 2022-06-09 04:45 897阅读 0赞

红色部分

  1. $("\#jstree\_demo")
  2. .jstree(\{
  3. "core" : \{
  4. "animation" : 0,
  5. "check\_callback" : true,
  6. 'force\_text' : true,
  7. "themes" : \{ "stripes" : true \},
  8. // so that create works
  9. "check\_callback" : true,
  10. 'data' : function (obj, callback) \{
  11. var jsonstr="\[\]";
  12. var jsonarray = eval('('\+jsonstr+')');
  13. $.ajax(\{
  14. type: "POST",
  15. url:url,
  16. dataType:"json",
  17. async: false,
  18. success:function(result) \{
  19. var arrays= result;
  20. for(var i=0 ; i<arrays.length; i++)\{
  21. console.log(Object.getOwnPropertyNames(arrays\[i\]).sort());
  22. var arr = \{
  23. "id":arrays\[i\].id,
  24. "parent":arrays\[i\].pid==""?"\#":arrays\[i\].pid,
  25. "text":arrays\[i\].name,
  26. "type":arrays\[i\].iconSkin,
  27. "state": \{"opened" : true\}
  28. //"state": \{"selected":true\}
  29. \}
  30. jsonarray.push(arr);
  31. \}
  32. \}
  33. \});
  34. callback.call(this, jsonarray);
  35. \}
  36. \},
  37. "plugins" : \[ "search", "state", "types", "wholerow","checkbox" \]
  38. \});

发表评论

表情:
评论列表 (有 0 条评论,897人围观)

还没有评论,来说两句吧...

相关阅读